The victim, a mum, was alerted by friends who spotted the private picture on the site.

The court heard she had been left embarrassed and “constantly wondering” if people she walks past in the street, or at nursery, had seen her image online.

The traumatised woman reported the matter to police who prosecuted Fairley under new laws addressing what is widely dubbed “revenge porn”

Prosecuting, Alex Mann said: “ The case involves this defendant sending a picture of an intimate nature without the woman’s permission. It had been posted on Instagram. Other people clearly have seen it and that’s mentioned in the victim’s statement.

“Two of her friends have made her aware of it and that’s where her distress comes from.”

The court heard the victim did not know how long the image had been on before it was removed, or who may have saved it, and how long it could be around for online.

Ms Mann added: “The defendant admits he had sex with her behind his partner’s back.

“The victim mentioned this to the partner and the relationship suffered problems and in revenge he posted this picture.

“He said he held on to the picture because she too had mentioned pictures in the past, and he kept this one as ‘insurance’.”

Defending, Steve Scott said: “Whilst this picture was posted on Instagram it was only on for a couple of minutes before it was taken down by the defendant.

“He thought when it was posted it was marked as private and that only the victim could see it.

“Unfortunately, and he doesn’t understand why, it has been seen by two friends of the victim. When she became aware she tried to access it but it had already been taken down.”

Fairley admitted a charge of providing a sexual photograph with the intent of causing distress, without the consent of a person in the image.

The case is adjourned to February 15 for a pre sentence report to be prepared, and Fairley was given conditional bail.

Revenge porn - the sharing of private, sexual photos or videos, of another person without their consent - is a growing issue and was criminalised in the introduction of legislation last February. Those convicted of the crime could face up to two years in jail.