A dog has undergone gender reassignment after vets discovered she is intersex.

Molly, a pet Jack Russell, was born with elements of both male and female genitalia.

She has fully recovered after undergoing gender reassignment surgery after her owners Mary and Frank Finlay noticed that she acted strangely when she went to the toilet.

The pooch had endured “significant” abrasions and discomfort before undergoing the “complex” operation.

Molly, now 18 months old, underwent the surgery last June.

Mr Finlay told BBC Scotland’s Kaye Adams Programme: “We got Molly in November 2015 and noticed that around the house she would squat to do her pees but outside she would lift her leg.

“I mentioned this early on in 2016 to one of Ross’s colleagues and they came up with the probability that she was a hermaphrodite, both sexes.

“They did MRI scans and X-rays, and eventually she was operated on in 2016. We still call her Molly.”

Mrs Finlay also commented, saying: “We’ve seen no change in her behaviour. She’s still the same wee Molly and we wouldn’t be without her, she’s too precious.”

It was discovered by the surgeon that Molly had testicles in place of ovaries within her abdomen.

Surgeons removed the elements of her male sexual organ and created a functional urethral opening.

Speaking to the BBC, Ross Allan, the surgeon, who works at Pets’n’Vets, said: “Molly was what is defined medically as a male pseudohermaphrodite, or more commonly ‘intersex’.

“Her particular anatomy meant that whilst Molly appeared to be a female, closer examination revealed elements of both male and female external genitalia, and unfortunately this was leading to significant genital discomfort.

“If left untreated, this risked her developing a long-term and debilitating condition.

“We decided that the very best solution for Molly was to proceed with definitive surgery to create an anatomical situation which would avoid ongoing issues or discomfort.

“The surgery was a great success and Molly is much more comfortable and happier as a result.

“Intersexism is rare in pets and some cases will not require any treatment at all.

“In Molly’s case, it was a painful condition which was causing problems and surgery was an important step to ensure she was able to go on to live a pain-free life.”

A pet shelter last year put out an adoption appeal for a dog that is biologically intersex.