Anthony Kirkbright sexually assaulted a woman at the victim's home in Blackburn in June 2021.
The 54-year-old was arrested, charged and remanded into custody following the assault.
While in jail, Kirkbright sent a letter to Greenbank Police Station which purported to be from the victim.
The letter, which claimed Kirkbright was innocent, was stamped with a HMP Altcourse postage stamp – the prison where Kirkbright was remanded.
Kirkbright, of no fixed address, was also arrested in August 2020 after he was seen harassing and sexually assaulting a pensioner at Accrington bus station.
Kirkbright was sentenced to four years custody, with a further 12 months to run concurrently for breaching a court order.
The order prevented him from harassing directly or indirectly, either physically or verbally, any female whether in private or public.
Kirkbright pleaded guilty to two sexual assaults, attempting to pervert the course of justice and breaching a Sexual Harm Prevention Order (SHPO).
He was subsequently jailed for four years and was subjected to an updated SHPO.
He had previously been ordered to sign the Sex Offenders Register for life.
DC Tom Dawson, of the East MOSOVO Team, said: "I am pleased with the sentence and that the courts have imposed orders which will restrict Kirkbright's association with women when he is released from custody.
"Like the Judge in this case, I believe Kirkbright is a danger to women and I am pleased the public now have some respite from his grotesque behaviour."
"A lot of work went into securing these convictions and I would like to praise all the staff and our colleagues from the Crown Prosecution Service, for their efforts."
If you or somebody you know has been the victim of a sexual offence report it to police via 101 or https://doitonline.lancashire.police.uk/.
"I hope this case and it's outcome will encourage other victims of sexual abuse to come forward," DC Tom Dawson added.
"They can do so knowing they will be listened to, believed and that Lancashire Police will do everything in our power to keep them safe and bring the perpetrator to justice."
It is thanks to our loyal readers that we can continue to provide the trusted news, analysis and insight that matters to you.
For unlimited access to our unrivalled local reporting, you can take out a subscription HERE and help support the work of our dedicated team of reporters.