A handcuffed prisoner from the Elgin Mental Health Center who escaped from a state vehicle Wednesday morning was captured eight hours later after he hailed a cab in Elgin, ending a manhunt that kept the community on high alert much of the day.

Jesse Vega, 33, also identified in court records as Jesse Ortiz, was being transported from the mental health hospital to a hearing at the Lake County courthouse in Waukegan about 8 a.m. when he fled from the vehicle near Seneca Street and Dundee Avenue in Elgin, according to authorities.

Vega was taken into custody about 4 p.m. after he was seen flagging down a cab near St. John and Summit streets, Elgin Police Cmdr. Ana Lalley said. He was still wearing handcuffs.

“The cab driver called their dispatch center, and our dispatch was already on the phone with them, so it was kind of simultaneous,” Lalley said.

Vega escaped from the state vehicle when it stopped at a gas station located at Summit Street and Dundee Avenue in Elgin, according to Elgin police.

A citizen in the 400 block of Prospect Avenue reported hearing noise in her backyard and saw Vega hail the cab, according to police. The cab driver then stalled Vega long until officers arrived on scene to take him into custody.

Vega is scheduled to appear in Kane County bond court Thursday morning in Elgin.

Earlier this year,Vega was declared unfit for trial on charges brought against him last year in Lake County. He allegedly attacked a woman he knew in the parking lot of Six Flags Great America lot in Gurnee on Sept. 29, fracturing her skull and causing her brain to bleed, said Cynthia Vargas, spokeswoman for the Lake County State’s Attorney office.

The woman survived the attack, Vargas said.

Vega was charged with aggravated domestic battery, aggravated battery causing great bodily harm, aggravated battery in a public place, obstructing justice and aggravated driving under influence with a suspended or revoked license, Vargas said.

On April 28, Vega was found unfit to stand trial and was ordered to the Department of Human Services for fitness restoration, court records show.

On June 4, he was placed at the Elgin Mental Health Center, one of several state-operated mental health hospitals. A court hearing pertaining to Vega’s case had been scheduled for Wednesday.

During the manhunt, helicopters flew over the area and there was heavy police presence on Dundee Avenue south of Interstate 90. Armored vehicles were seen driving through neighborhoods and some police personnel carried assault rifles.

Residents were notified of the escape via a city email alert around 10 a.m. and were warned by police not to approach Vega if they saw him.

Kenneth Johnson, who lives just north of the area where Vega was captured, was working in Lombard when he heard of the escape.

He called his family members at home and told them “to hunker down ... lock themselves in the house and hang tight until it was all clear.” He learned of Vega's capture by an automated phone call made to the home from the police.