Kristofor Rorrison, 24, pounced on his victim outside a flat in Edinburgh’s Tollcross in July this year.
The woman repeatedly screamed at him to stop as he pinned her to the ground.
The 23 year-old’s terrifying ordeal only ended when a man heard what was happening and yelled he was calling the police.
Rorrison now faces a lengthy jail-term after he admitted to an attempted rape charge at the High Court in Glasgow.
He was remanded in custody pending sentencing next month.
The pair had been at a house party and ended up chatting outside.
Prosecutor Shirley McKenna said Rorrison began “coming on” to the woman and “implied” he wanted sex with her.
He then exposed himself – leaving the victim feeling “shocked”.
The hearing was told Rorrison soon pushed the woman to the ground and straddled her.
Miss McKenna: “She tried to fight him off and said ‘stop’ loudly.”
The victim – who ended up amongst nettles – attempted to kick Rorrison described as “significantly” bigger than the woman.
A neighbour then heard screams and spotted Rorrison with his trousers down.
Miss McKenna: “The person said police were being contacted. Rorrison then ran away.”
The court was not told how badly affected the woman was. She did provide a victim impact statement which was handed to judge Lord Mulholland.
Rorrison, of the capital’s Muirhouse, also pled guilty to a drugs charge.
The judge deferred sentencing for reports until December 6 in Livingston.
Lord Mulholland told Rorrison: “You should be under no illusion of what the disposal will be in this case.”
Rorrison was also placed on the sex offenders register.
Join our Facebook group Our Edinburgh to share images and news from and around the Capital