He pleaded guilty to one count of harassing Jemima - identified in the charge as Mrs Khan - on September 27, last year and is now banned from contacting her and going within 200m of her Chelsea home or visiting her Marylebone office.

“That taxi arrived with the intention of taking her to a restaurant and must have made Mrs Khan extremely concerned about you, someone who keeps persistently tweeting her and wondering what would come next,” Deputy District Judge Adrian Turner told him.

“That’s the harm this offence causes. She had no way of knowing about your problems that lay behind the behaviour.

“The tweeting has stopped, you are receiving treatment and I hope this has allayed her fears and concerns.”

He had an adverse effect on the 42 year-old mother-of-two’s usual day-today activities by contacting her on social media and sending the Addison Lee taxi to her home address.

He sent the cab so she could meet him at a restaurant and hand-delivered letters to her home and tried to talk to her over the intercom.

O’Mahoney also bombarded Jemima and her friends with Twitter and Instagram messages.

In 2015 he was cautioned by the police for tweeting her five times a day and approaching her outside a hotel and asking her out to dinner.

His bipolar disorder was diagnosed in 1999, but worsened by five years of skin cancer treatment and extensive dental surgery.

Prosecutor Miss Kerry McNulty told the court today: “Mr. O’Mahoney ordered an Addison Lee taxi to her home address, which was given instructions to drive her to a restaurant in central London.

“He sent her messages via twitter to meet him at this restaurant.

“She was particularly concerned he ordered a taxi to her address because it shows he knew where she lives.”

DDJ Turner added: “This is one of the most comprehensive pre-sentence reports I’ve ever read. It runs into twelve pages.

“You have been diagnosed and it is a condition you’ve had for a very long time. It has not resulted in violence.

“There is little risk of this ever turning into something more menacing or risk of physical harm, but she was not to know.

“All she knew was you were tweeting obsessively and sending the taxi.”

The probation order includes a mental health treatment requirement

and thirty-day activity requirement and O’Mahoney must also pay £85 costs and an £85 victim surcharge.

If jobless O’Mahoney, who lives on benefits, breaches the restraining order he faces a maximum of five years imprisonment.

Westminster-born Jemima was married to Pakistani cricket legend Imran Khan between 1995 and 2004 and is identified in the charge under her married name.

Her parents are millionaire financier Sir James Goldsmith and Lady Annabel Goldsmith.

Her brother, Conservative politician Zac Goldsmith, 42, recently lost his Richmond Park seat and failed in a bid to become Mayor of London.