A man was sentenced Thursday to life in prison for raping and killing a Muslim teenager in Virginia as she walked back to a mosque with friends for pre-dawn religious services.

The life sentence without possibility of parole imposed Thursday on Darwin Martinez-Torres of Sterling was a formality after his guilty plea last year in the June 2017 slaying of 17-year-old Nabra Hassanen of Reston. That plea bargain required a life sentence but eliminated a potential death penalty.

Hassanen's death received widespread attention amid concerns her slaying was motivated by anti-Muslim sentiment. Prosecutors, though, say Martinez-Torres attacked her after he got out of his car to chase Nabra's group of friends in a road-rage confrontation.

News outlets reported that Fairfax County Commonwealth's Attorney Ray Morrogh said after the hearing that the sorrow of Nabra's killing "will ripple through this community for a hundred years."

Prosecutors say the attack began when Martinez-Torres drove by and honked his horn at one of Nabra's friends who had been riding his bicycle in the road as they walked back to their mosque. The friend yelled back at Martinez-Torres, who started chasing the group, first in his car, and then on foot.

Nabra, who was wearing sandals, couldn't run as fast the others, and Martinez-Torres caught up with her, wielding a baseball bat. A friend of Nabra's described hearing a "thud and a metal ping" when she looked back. Some friends started to go back to help Nabra, but Martinez-Torres scared them off with his bat.

Martinez-Torres, a native of El Salvador who federal immigration authorities have said is in the country illegally, was caught shortly after the attack. He initially denied attacking Nabra but quickly confessed under questioning from detectives. He told them that he "got out of control" and that after he first struck Nabra with the bat he "just kept thinking ugly things."

Police have said he took her close to a nearby pond and raped her while she lay unconscious, then dumped her body in the water after she died.

Martinez-Torres' lawyer, Joseph Flood, has said his client has intellectual disabilities, and that his IQ is below 68.

The plea deal carries an unusual provision that requires Martinez-Torres to answer any questions posed of him by the victim's family over the next year.

Nabra's father, Mahmoud Hassanen, has been outspoken about his concerns that Nabra's death may have been a hate crime. Prosecutors have characterized it as a road-rage attack.