A man has been given an order of lifelong restriction after he pled guilty to attacking a woman with intent to rape as she walked in a Dunfermline park.
40-year-old Dean Stevens received the restriction at the High Court in Edinburgh, with a minimum sentence of two years and three months in jail.
The order mean that he will be subject to intense supervision, if he is released.
Last May, he followed a woman into Pittencrieff Park and pushed her to the ground.
After a struggle she went through, he ran away.
The woman has been recognised for her courage after the incident.
Detective Inspector Kelly McEwan, of the Fife Divisional Rape Investigation Unit at Police Scotland, said: "We welcome today's sentence, in particular the imposition of the Order of Lifelong Restriction which affords the protection of an indeterminate sentence, ensuring that Stevens' release is not guaranteed after his minimum sentence is served and he will not be released until the Parole Board are satisfied that imprisonment is no longer necessary for the protection of the public.
"This was a terrifying attack which I've no doubt was sexually motivated and would have been even more severe if the woman had not managed to fight him off.
"Fortunately she was not seriously injured but was left extremely shaken and upset.
"I want to thank her for her courage.
"I would also like to take this opportunity to say that Police Scotland is determined to bring sexual offenders to justice.
"We treat all sexual crime with the utmost seriousness and encourage anyone who has been the victim of sexual offending to come forward where they will be supported by specially trained officers.
"You can contact officers via 101, or 999 if it is an emergency."