A 54-year-old man was jailed for sexually assaulting women in Dunfermline and Edinburgh.
Colin Houghton was locked up for 21 months for the attacks on two vulnerable victims.
He was told the assaults were substantial breaches of trust and that only a custodial sentence was suitable.
One of Houghton’s victims has died since her ordeal at an address in Dunfermline in March 2016.
The other woman, aged 51 at the time, had been friends with him for several years when she was targeted at a flat in Edinburgh in April 2015.
Advocate Michael Anderson told Kirkcaldy Sheriff Court that Houghton, of Baxters Gate, Tranent, had accepted his guilt, contrary to the findings of a social work report which he admitted made “concerning reading”.
He said: “He is someone who does have his own difficulties in terms of cognisance of particular issues and understanding of certain things.
“Ultimately, he pled guilty to serious offences and I don’t wish to hide away from that but they were two single incidents during an 11-month period.
“His personal circumstances have greatly improved since then.”
Houghton’s partner of three years and his daughter were in court as he was sentenced.
Sheriff Jamie Gilchrist QC told Houghton: “Both of these offences, in particular the first one, represent a very substantial breach of trust.”
In the second assault, he said Houghton had “persisted quite forcibly” when the woman made it clear that she did not want a sexual encounter.
Houghton was also placed on the sex offenders register for 10 years.