Ryan Giroux, a 41-year-old ex-convict who has served three stints in state prison since 1994, was taken into custody early Wednesday afternoon, police said.

The morning spree included a shooting at a motel, a carjacking and a home invasion at a nearby apartment complex. The shooting prompted an intense manhunt as Mesa police searched the trunks of cars, interviewed witnesses and brought in SWAT and canine units from other agencies.

He served prison terms totaling more than eight years for burglary, theft, attempted aggravated assault and a marijuana violation, the Arizona Department of Corrections said.

Giroux was taken into custody after officers spotted him on an apartment balcony and deployed a stun gun. Numerous officers later led a handcuffed man to a truck parked outside an apartment complex.

The incident started with an argument inside a room at a motel and spilled outside, and three people were wounded there, Mesa police Detective Esteban Flores told The Associated Press. Giroux then allegedly shot a person at a nearby restaurant and carjacked a gray Honda Accord. Two more people were wounded at separate apartment complexes, including one during a home invasion.

Several locations in the area were placed on lockdown amid a heavy law enforcement presence, including police searching car trunks and interviewing witnesses. The Arizona Department of Public Safety sent its SWAT team to Mesa to assist with the effort, DPS spokesman Bart Graves said. Scottsdale police are also sending SWAT and canine units.

The shootings occurred near the East Valley Institute of Technology. Nearby Mesa Community College issued an emergency alert, saying its campus was on lockdown and anyone already there should proceed to the safest location. The shooting scene is also near a light rail line that travels through the metro Phoenix area.

Vinny Carbone owns an auto body shop near the shootings. He was getting ready to open up when he heard a man yell “help, help.” He later saw a woman outside the motel with what looked like a bullet hole in her side.