A man who attacked a Muslim state representative outside a prayer service in Connecticut pleaded guilty Tuesday to attempted sexual assault and other crimes in a plea deal that calls for a five-year prison sentence.

Andrey Desmond, 30, appeared in Hartford Superior Court in connection with the June 2023 assault on Rep. Maryam Khan, the first Muslim to serve in the state House of Representatives. He pleaded guilty to attempted third-degree sexual assault, attempted first-degree strangulation and risk of injury to a minor — all felonies, Hearst Connecticut Media Group reported.

Khan's lawyer, Aaron Romano, told a judge that Khan believed Desmond deserved a longer prison sentence given how serious the attack was. Khan attended the hearing but did not comment afterward.

CONNECTICUT DAY CARE WORKER ACCUSED OF THROWING TODDLER SIX FEET IN AIR INTO WALL

"Representative Khan is requesting privacy at this time to process today’s events, but she looks forward to her attacker’s sentencing on June 4," Romano said in a statement later in the day.

Desmond's attorney, public defender John Stawicki, told Judge David Gold that Desmond wanted to apologize to Khan. Desmond held off on apologizing after Gold warned that anything he said could be used against him if the plea agreement ended up being canceled for any reason.

Andrey Desmond

FILE - This booking photo provided by the Hartford, Conn., Police Department shows Andrey Desmond of New Britain, Conn. Desmond, who attacked a Muslim state representative outside a prayer service in Connecticut, pleaded guilty Tuesday, April 2, 2024, to attempted sexual assault and other crimes, in a plea deal that calls for a five-year prison sentence. (Hartford Police Department via AP, File)

The plea deal would also require Desmond, after the prison term, to register as a sex offender, undergo counseling and take his medication.

Court records show Desmond, who was living in New Britain, has a history of mental illness. After a court-ordered evaluation, he was found competent to stand trial.

Khan, a Democrat from the Hartford suburb of Windsor, had called for hate crime charges. She was attacked while attending a service at the XL Center arena in Hartford with her family to mark Eid al-Adha, the end of the Hajj, the annual pilgrimage by Muslims to Mecca.

She has said she and her family, including her 15-year-old daughter, were taking photos outside the arena when Desmond approached and said he "intended to have sexual relations" with one of them.

Desmond then followed them inside, and Khan said he started to pursue her in particular, grabbing at her face and shirt and demanding a kiss. He followed her back outside and tried to grab her face again, she said, and became angry when she "dodged him." She said he slapped her across the face and later put her in a "chokehold," holding up his hand and mimicking having a gun before slamming her into the ground.

Khan said she was diagnosed with a concussion and injured her right arm and shoulder.

The Associated Press doesn’t generally identify people who report attempted sexual assaults unless they publicly identify themselves, as Khan has done.

CLICK HERE TO GET THE FOX NEWS APP

Desmond was chased down and held by two bystanders until police arrived and arrested him. One of the bystanders, a military veteran, was charged with misdemeanor assault and has applied for a pretrial diversion program that could erase the charge.