A Mexican man convicted of sexual assault and other charges who was in the U.S. illegally had been deported from the U.S. 20 times, court documents show.

A judge sentenced Sergio Jose Martinez, 31, to 35 years behind bars Friday after Martinez pleaded guilty to sodomy, sexual assault, kidnapping, and other charges for attacking two women on separate occasions, the Associated Press reports.

Martinez told the two victims in the Portland, Oregon, courtroom that he would see them in hell after he learned of his fate from the judge.

Martinez attacked two women in Portland on July 24. He threatened and sexually assaulted his first victim, a 65-year-old woman, after he broke into her Northeast Portland home through a window she left open. He then stole her car and her purse.

Martinez approached his second victim in a parking lot with a knife and forced her to get into her vehicle. She attempted to escape, but Martinez grabbed her and pushed her head into the ground.

Police who had been monitoring Martinez after he stole the first vehicle apprehended him after he tried to flee the scene on foot.

Martinez took a plea deal that spared him from getting a longer sentence in exchange for pleading guilty to ten counts, including sexual assault, first-degree burglary, sodomy, second-degree assault, and kidnapping.

Jonathan Sarre, Martinez’s attorney, said his client “suffers from some mental illnesses” that may have caused him to act inappropriately.

However, Sarre acknowledged that a doctor declared his client competent enough to stand trial.

Court documents filed in March show that U.S. officials deported Martinez 20 times for several probation violations after being convicted of felony burglary and for crossing into the U.S. illegally.

Officials freed Martinez from a Portland-area jail a week before the July 24 attacks, after he was accused of interfering with police and giving a false birth date.

Martinez had been released despite Immigration and Customs Enforcement’s (ICE) request to the jail to keep him there until the agency could take him into custody.

In a separate instance, officials released him from Multnomah County Jail into the community without notifying ICE in December 2016 after he faced kidnapping, sodomy, robbery, and assault charges in a separate case.

ICE wanted the local authorities to notify them when Martinez was set to be released.

The county sheriff and other Multnomah County officials wrote a letter defending their decision to release him.

“The Sheriff’s Office does not hold people in county jails on ICE detainers or conduct any immigration enforcement actions,” the letter read in part.

Officials released Martinez in accordance with a 1987 Oregon law that prevented law enforcement from keeping people in custody who entered the U.S. illegally but did not break any other laws. Oregon became the nation’s first “sanctuary state” after the law passed.

Attorney General Jeff Sessions used Martinez’s case as an example of how some local jurisdictions do not comply with federal immigration agents when he visited Oregon in September, urging local jurisdictions there to change their policies.