A High Court judge has stopped a transgender lawyer and a Catholic commentator from mentioning each other on social media following an “out of control” Twitter row between the pair.

Stephanie Hayden, a trans woman, was granted an injunction against Caroline Farrow after claiming she was subjected to a “barrage” of abusive tweets at a hearing in London on Thursday.

But Mr Justice Bryan also asked Ms Hayden to give a legal undertaking that she would not mention Mrs Farrow on social media either – which she agreed to do.

The judge said he considered that a number of tweets sent by mother-of-five Mrs Farrow, whose husband is a priest, had “crossed the line” from being unreasonable to oppressive and were “unacceptable”.

He granted Ms Hayden an interim injunction which prevents Mrs Farrow from mentioning her at all on social media, in particular from “misgendering” her by referring to her as male when she is legally female.

The judge added: “It is quite clear that the tweeting that has been going on between (Ms Hayden and Mrs Farrow) has got out of control.

“Each have said things in those tweets which, in the cold light of day in this court, I would anticipate they would rather wish they had not done.”

Representing herself, Ms Hayden told the judge she had been embroiled in an online debate with Mrs Farrow over transgender issues since January, but that the row “escalated” in April.

She complained Mrs Farrow harassed her in a series of tweets by referring to a spent conviction from 20 years ago for affray, suggesting she was violent, misgendering her and posting a photograph of her.

Ms Hayden told the court: “It was a clear attempt by the defendant to, I say successfully, whip up a social media storm.”

Mrs Farrow denied the claims and her lawyers argued she had been subjected to abusive tweets from Ms Hayden.

Her barrister, Amanda Jones, said: “What the claimant has described as robust criticism of the defendant has been a positive avalanche of abuse over a number of months.”

The court heard both Ms Hayden and Mrs Farrow have previously been involved in other rows on Twitter over similar issues.

In March, Ms Hayden withdrew a libel case against comedy writer Graham Linehan, whose credits include Father Ted and the IT Crowd, which she launched following an online exchange.

Ms Hayden later tweeted that the case had cost Mr Linehan £28,000, the court heard.

Mrs Farrow was investigated by police after the founder of transgender support charity Mermaids, Susie Green, accused the commentator of misgendering her daughter on Twitter.

Ms Green later withdrew the complaint and Surrey Police announced in March they would take no further action.