A Conservative activist who sent messages claiming to have paid “crackheads” £100 to beat up the Labour MP Yvette Cooper and warned that “if you make peaceful revolution difficult you make a violent one inevitable” has been jailed for nine weeks.

Joshua Spencer, who received a character reference from the Conservative MP Andrea Jenkyns, attended Cooper’s general election count in December as a representative of the Conservative party despite being under investigation by West Yorkshire police after his arrest.

The unemployed 25-year-old, a constituent of Cooper’s, was arrested in April last year and stood for the Conservatives in May’s local elections.

Spencer pleaded guilty in January to sending malicious messages about Cooper, a former work and pensions secretary who has been MP for Normanton, Pontefract and Castleford since 1997.

On Friday he was sentenced to nine weeks in prison and given a restraining order preventing him from contacting Cooper or her former office manager, Jade Boterill, for 10 years.

The Tories said “we extend our sympathies” to Cooper and said Spencer has now been expelled from the party.

Joshua Spencer sent the messages to a man he met on a dating site. Photograph: Facebook

In a message sent last April to a man he met on a dating website, Spencer suggested Cooper should “pay” for trying to thwart a no-deal Brexit, after MPs voted to stop the UK leaving the EU on 29 March 2019 as planned.

“We should have left no deal on the 29th before the whore Yvette got her hands on to it and voted to revoke democracy. She will pay. I’m already organising … to hurt her. Amazing what crackheads will do for £100. I’m going to get her beat up,” he wrote.

In another message he said: “It’s doing me head in that Labour who claim to represent the working class are actively going against the working class … If you make peaceful revolution difficult you make a violent one inevitable.”

Speaking after Spencer was sentenced, Cooper called on the Conservative party to explain whether it was aware of concerns over Spencer’s behaviour.

She said: “I have asked the Conservative party what action they took last year after the investigation began, why Mr Spencer was still able to attend the general election count as their representative ... whether anyone locally or nationally in the party had raised concerns about his behaviour or position and what action they are taking now.”

As he was being handcuffed, Spencer said he was “extremely sorry” for what he had done and insisted he never intended to hurt Cooper. He also asked to see a psychiatrist in prison.

His lawyer, Sheik Amin, had told the court Spencer had experienced significant mental health problems after the suicide of his father, and that at the time of sending the messages last April he was “in drink”. It was the day after his birthday and he was having suicidal thoughts that his father was not there to help him celebrate, Amin said.

Jenkyns, who defeated Cooper’s husband, Ed Balls, in the Morley and Outwood constituency in 2015, gave a statement to Leeds magistrates court defending Spencer.

In the statement read to the court on Friday, she said Spencer was “a decent and honest person whose heart is in the right place and who always helps people in need”.

She said she did not condone what he had done but claimed he had been “let down by the system” and desperately needed help for his mental health problems, including biopolar disorder and suicidal thoughts.

As well as attending the count in Cooper’s constituency, at which the Labour MP was present, Spencer was at the “Big Brexit Bash” organised by Jenkyns in Morley on 31 January.

In an additional statement, Jenkyns said: “I stand by my decision to have given him a personal reference.”

Noting that he had bipolar disorder and saying that she was concerned about his mental health issues, she added: “I will be seeking assurances that he will get the support he clearly needs as part of his rehabilitation.”

In a victim impact statement read to the court, Cooper said Spencer was well-known to her and her constituency staff. She said case workers had given him considerable help with his mental health problems in 2017, when they were “concerned for his welfare”.

In the statement she said: “MPs across the country, particularly women MPs, have unfortunately become accustomed to a continued stream of abuse online and threats from a small number of people, often on the extreme fringes of politics. But this behaviour is not normal, and we must never treat it as so.”

At least 10 people have been cautioned for making threats against Cooper, according to her staff.

Spencer, who co-founded a group called Brexiteers of Normanton, Pontefract and Castleford, was arrested after the message was passed to Hilary Benn, the Labour MP for Leeds Central, who alerted Cooper’s office.

He denied sending the message, suggesting he was being targeted for his political views, and was released under investigation. The following month he stood unsuccessfully for the Conservatives in the local elections in the former pit village of Knottingley.

In June, he organised a demonstration against Cooper outside her constituency office in Castleford. The protest took place the same day as Cooper was taking part in The Great Get Together, a national event commemorating the MP Jo Cox, who was murdered by a far-right extremist just before the EU referendum in 2016.

In court on Friday, the prosecutor, Susannah Proctor, read out a series of tweets posted online in September by Ellie Cooper, one of the MP’s three children, talking about how she feared for her mother’s life.

Remembering the day Jo Cox was killed, Ellie Cooper wrote: “I am scared because on the 16th of June 2016, two children said goodbye to their mother before she left her constituency to sit in surgeries and help people all day and never saw her again. I am scared every single day that the same will happen to mine.”

Sentencing Spencer to nine weeks’ immediate imprisonment, the district judge, Marie Mallon, said his offence was so serious because of the context in which it took place, following Cox’s murder. She said such abuse targeted at politicians acted as a “deterrent” for people who might otherwise enter public office, “particularly women”.

In a statement read to the court, Boterill described how she worked for Cooper for six years and loved her job but quit last June because of the threats she received on Cooper’s behalf.

A Conservative Party spokeswoman said: “This kind of conduct has no place in our public life and we extend our sympathies to Yvette Cooper for the distress and harm this incident must have caused.

“Mr Spencer has been expelled from the party, following his suspension from the party when he was charged in court for these offences.”

