A 34-year-old man was in breach of a restraining order when police found him in a house in Portadown and a search uncovered drugs in his pocket.
Paul Davidson, Woodlawn Villas, Carrickfergus, appeared last Friday at Craigavon Magistrates Court by videolink from Maghaberry prison.
Through defence barrister Aaron Thompson he admitted three charges.
For breach of a restraining order he was sentenced to four months in prison while concurrent one month terms were imposed for possession of cannabis and possession of Valium.
The court heard that on March 31 this year police went to an address in Jervis Street in Portadown concerned at a suspected breach of a restraining order.
A female admitted them into the property and they found the defendant in the kitchen.
He was on court bail at the time and was not to be within 50 metres of the house in Jervis Street.
A search of him uncovered class B and class C drugs in his pocket.
Mr Thompson explained that Davidson had been in a relationship with this lady and she had invited him into her property.
He added that there was no allegation of any violence and the police body-cam coverage showed Davidson acting in a calm manner and walking with his head bowed.
Mr Thompson said his client was not trying to intimidate her in any way but because he was on bail at the time was an aggravating feature.
He added that Davidson struggled to abide by the letter of the regulations and was well aware he was facing an immediate prison sentence.