A judge has suspended the final three years of a man's 12-year rape sentence on condition the attacker completes a Leaving Cert.

Gerard Kane, 36, formerly of Dominic Street in Dún Laoghaire in Dublin, raped a woman after breaking into her home in June 2011.

Kane has spent most of his adult life in prison, with 26 previous convictions for burglaries, robberies, drug possession and assaults.

On the night of the rape, he was on bail for a burglary on the constituency office of former Fianna Fáil minister Barry Andrews.

Five days into the trial, Kane changed his not guilty plea and admitted breaking into the woman's apartment and raping her twice.

Kane threatened to bury the rape victim in the back garden and said he would hang himself if she went to the gardaí.

As he left the scene, he hugged her and asked for her number so he could take her out to dinner.

Mr Justice Garrett Sheehan paid tribute to the victim.

He said she was an excellent witness who had undergone huge suffering, and had shown great resilience to come to court to recount her experience.

Judge Sheehan imposed a 12-year sentence on Kane, but suspended the final three on condition that Kane completes two years of study for his Leaving Cert, and then an additional two-year educational course.