A man who shot at nearly a dozen Phoenix homes over several months to terrorize his ex-girlfriend and her extended family has received a 22-year prison sentence, prosecutors said Wednesday.

Manuel Anthony Sierra, 22, was sentenced after pleading guilty to drive-by shooting, Maricopa County Attorney Rachel Mitchell said in a statement. The prosecutor also said 32 victims were granted lifetime injunctions barring Sierra from contacting them for the rest of his life.

ARIZONA MAN ARRESTED FOR RANDOM KILLINGS OF 2 MEN AT GLENDALE BUS STOP

According to prosecutors, Sierra drove to 11 homes and randomly opened fire on dwellings and cars over a six-month period in 2021 and 2022.

Pheonix, Tucon, Flagstaff news

Manuel Sierra, 22, of Phoenix, has been sentenced to 22 years in prison for perpetrating 11 non-fatal drive-by shootings over a six-month span. (Fox News)

Relatives of his ex-girlfriend were present during all but one of the shootings. Nobody was wounded despite bullets hitting a front door, living room and bedroom windows in some instances, according to officials.

Authorities said Sierra also set a car on fire.

CLICK HERE TO GET THE FOX NEWS APP

Investigators used video surveillance and Sierra's phone to tie him to all the incidents. Bullet casings from the scenes matched two handguns found in his home and the cars used in the shootings. His phone history also showed Sierra had heavily researched family members and texted anonymous threats.