But months after he was granted asylum, Mahmud attacked the lone woman as she made her morning walk to her office.
Swansea Crown Court heard the migrant knocked her over from behind as the pair struggled on the ground.
But Mahmud overpowered his victim and raped her twice as lay pinned down to the pavement in Swansea city centre.
He then ran off, but was was arrested just 45 minutes later after police received calls about a man acting suspiciously in a nearby residential area.
This incident has had a life-changing impact on the victim and our thoughts first and foremost are with her.DCI Esyr Jones
The woman, who cannot be named, is now said to be too scared to leave her own home ever since the attack in April.
Mahmud, of Mount Pleasant, Swansea, pleaded guilty to two counts of assault by penetration, two counts of rape, assault occasioning actual bodily harm and making a threat to kill when he appeared in court.
He was jailed for 12 years.
Detective Chief Inspector Esyr Jones said after the sentencing: "This was a very serious incident which understandably caused a lot of public concern.
"A lone female was walking to work when she was assaulted and raped in terrifying circumstances.
"This incident has had a life-changing impact on the victim and our thoughts first and foremost are with her.
"Stranger attacks, such as this one, are rare in Swansea but when they do occur we have specialist officers to thoroughly investigate these crimes and with independent partner agencies are able to provide support and care to victims."