A depressed immigrant who sent death threats to Barking MP Margaret Hodge has walked free from court.

Maxwell Maundy, 31, sent abusive letters to the MP, as well as a police watchdog and Home Office officials, claiming they had “betrayed” him after he helped secure the conviction of a corrupt border officer.

Between August and September last year he warned he would launch a terrorist attack on Westminster Underground Station using petrol in water bottles, and threatened a “Raoul Moat-style” attack on Ms Hodge, alluding to an infamous three day police manhunt in 2010 which ended in the gunman’s death.

Maundy, originally of Ghana, had become depressed when police declined to extend his leave to remain in the UK in 2009.

Defending, Lalith de Kauwe said he had helped the Met carry out an undercover sting operation on a UK Border Agency Official who had promised to help Maundy remain in the country in exchange for a £1,500 bribe.

Despite him giving evidence in a trial which led to the conviction of the border official, police did not to help Maundy secure a new visa.

“He was dumped; he was abandoned,” said Mr de Kauwe.

“He felt there was no sense of fairness in the way in which those that had used him to secure conviction had provided him with anything – even a word of thanks.”

Maundy, of no fixed address, wrote increasingly threatening letters to public figures and bodies as his mental health deteriorated.

He surrendered himself to police in May, and had been remanded in custody since. In September, he made an unsuccessful suicide attempt at Pentonville Prison.

Sentencing Maundy at Snaresbrook Crown Court on Friday, Judge Murray Shanks said: “In these letters you make threats to do things that are really very serious.

“You make a number of references to ‘stupid white people’ and call police ‘beasts’ and ‘animals’ and so on.

“[But] you have shown regret by pleading guilty and surrendering to police, and I am told you now want nothing else but to go back to Ghana where you have a six-year-old daughter.”

Maundy was sentenced to eight months in prison for racially aggravated harassment, and two months concurrently for two counts of malicious communications. He has served half the sentence already, meaning his guilty plea leaves him free to return to Ghana.