A sex offender repeatedly ran into the road when he was meant to be seeing his probation officer.
Harry Trayte, formerly of Thongsbridge, was earlier this month sentenced after admitting exposing himself to a member of staff at the Carphone Warehouse in Dewsbury.
The female worker said she was physically sick after the 23-year-old pulled down his boxer shorts as she tried to help him with his phone.
Trayte’s behaviour was described at a previous hearing as a form of attention seeking due to his mental health difficulties.
He was ordered to sign the sex offenders’ register for five years.
He was also told to comply with an 18-month community order involving mental health treatment and up to 30 days of rehabilitation activities.
But police were called by staff as Trayte attended his appointment at the Huddersfield Probation Office in St John’s Road on Tuesday (September 19).
Alex Bozman, prosecuting, told Kirklees magistrates: “Trayte was being aggressive towards staff and refusing to leave.
“The officers were directed towards where he was and after a number of discussions he was asked to leave.
“He was sat outside the door, refused to leave and says that he wanted to be arrested.”
Continued efforts were made to get Trayte, currently of no fixed address, to leave, magistrates were told.
Mr Bozman added: “Eventually he did move, but stood in the middle of the road.
“He was removed but then returned to the middle of the road and narrowly avoided traffic.
“Police had concerns that he would either go back to the probation office or cause an incident on the road.
“They arrested him to prevent any breach of the peace.”
Trayte, who appeared at the Huddersfield court from custody, admitted that his behaviour resulted in a breach of the peace.
He claimed that he was trying to get away because nobody was helping him.
Trayte, who was not represented, told magistrates: “I haven’t admitted to anything – you made me admit to it.
“I believe I haven’t got the right to say anything but I don’t like talking to solicitors.”
Magistrates bound Trayte over to keep the peace for 12 months.
If he fails to do so he will have to forfeit a sum of £50.