A Kansas City man was sentenced Thursday to nearly 22 years in federal prison for committing a hate crime when he shot and wounded a teenager because of the victim's sexual orientation, prosecutors said.

Malachi Robinson, 25, pleaded guilty in July to violating federal hate crime laws when he shot the 16-year-old eight times on May 29, 2019. He was sentenced Thursday to 21 years and 10 months in federal prison without parole.

The teenager survived after spending two weeks in the hospital but underwent several surgeries and physical therapy and still has bullets in his body, prosecutors said.

MISSOURI FORMER HIGH SCHOOL FOOTBALL COACH PLEADS GUILTY TO 18 CHILD SEX CRIMES: REPORTS

Missouri Fox News graphic

A man has been sentenced to nearly 22 years in federal prison for an anti-LGBTQ+ hate crime in Kansas City.

CLICK HERE TO GET THE FOX NEWS APP

Court documents said the two met by chance and were walking near Swope Park when Robinson suggested they go into a wooded area to engage in a sex act. But Robinson wrote separately to his girlfriend that he "might shoot this boy" because of his sexual orientation.

When the teenager changed his mind and tried to leave, Robinson shot him eight times, prosecutors said. He was able to get away and eventually collapsed near an apartment building, where a bystander called 911. Before his arrest, Robinson told several people that he shot the victim because of his sexual orientation, according to court documents.