A Canberra man caught masturbating in public for the second time has narrowly avoided being sent to jail.

In May 2013, Mark Stephen Ridley, 53, walked to the back of a discount store at the Kippax Shopping Centre in Canberra's north, and began to masturbate during the store's busy lunch hour.

The ACT Supreme Court heard a woman out shopping with her granddaughter spotted Ridley in the act and quickly turned her grandchild away.

A staff member then saw Ridley walk out of the store, with his pants undone and his penis exposed.

During his sentencing hearing, the court heard that in 2012 Ridley was seen masturbating in his car, which was parked outside the Canberra Centre in the city.

He had the windows down and was moaning loudly, when another random passerby spotted him.

For that offence he was placed on a good behaviour order, which he breached with this most current charge.

Earlier this year Ridley pleaded guilty to the act of indecency, one his lawyer Richard Davies explained was committed under the influence of the drug ice.

"It is not the case that he set out to make an exhibition of himself," Mr Davies said.

"When he started out to do what he was doing, there was nobody around."

However crown prosecutor Sarah McMurray said it would be difficult to explain Ridley's actions away as an accident.

"He was masturbating in a public place at 1:30pm in the afternoon," Ms McMurray said.

"At 1:30pm in the afternoon... in a shopping centre?"

In sentencing, Justice Richard Refshuage noted Ridney had been abused as a child and suggested much of his past criminal behaviour stemmed from a "long and problematic drug and alcohol history".

"I am satisfied that Mr Ridley is truly remorseful," Justice Refshauge said.

"I think (Ridley) you're starting to recognise that your life needs to get onto another track."

He sentenced Ridley to 10 months in jail, fully suspended, with a two-year good behaviour bond and 70 hours of community service.