Scottish Tory leader Douglas Ross had to phone his wife at work to tell her a “credible” death threat had been made against him.
He said that while police had acted “very quickly” to deal with the situation, he wanted to alert his wife Krystle, a police sergeant, before she saw details of it on her work computer.
He spoke about the death threat as he told how politicians can suffer “extremely vicious” abuse online.
Mr Ross, speaking in a question and answer session at the Scottish Conservatives’ conference in Glasgow, said people had “piled in” after a recent interview he gave to the Scottish political magazine Holyrood.
“Politicians have to accept we get a fair share of criticism, people are entitled to do that,” he said.
But Mr Ross, MP for Moray and an MSP for the Highlands and Islands region, added: “It’s amazing how people think they can put anything up there and it to be true because they have typed it in.
“These are words and phrases they would never say to you in person, they would never come up to you and say what they say on social media to your face.
“And I think some of the protection they feel behind the keyboard allows them to get away with far too much.”
Mr Ross said: “One of the particular death threats I got in Moray was acted upon very quickly by our local chief inspector.
“I’ve got a process, all MPs and MSPs have a process they go through, when they get credible threats like that.
“Also I had to then phone Krystle, she was on duty at the time as a sergeant. This would come up on her computer screen that the local MP has a death threat against him, and she happens to be married to him.
“So I wanted to make sure she was aware of that before it started going through her system.”
He recalled: “I used to do the milking at two in the morning and two in the afternoon. The two in the morning milking, no-one else was there, no-one would bother you and you were alone in your thoughts, you could think of many things.
“I’m not quite alone so much now, there’s demands of my time, but it was a career I thoroughly enjoyed. It was something I was passionate about.”
He added: “While I don’t have cows any more I have got two black and white goats, we now have pygmy goats to add to the chickens in our household. So that’s a wee bit of farming still going on there.
“My day off tomorrow is going to be clearing them out.”