FRISCO, Texas (CBSDFW.COM) – After a standoff that lasted nearly 15 hours at a Frisco apartment complex, a 42-year-old suspect was taken into custody early Saturday morning. A trooper who was shot during the incident is also recovering in the hospital.

The suspect was identified as Bryan M. Cahill of Frisco.

The whole incident started Friday afternoon when the suspect led a Texas Department of Public Safety trooper on a chase from the Dallas North Tollway near Spring Creek to the La Valencia apartment complex on Lebanon Road.

At some point after the vehicle stopped, there was an exchange of gunfire between the trooper and the suspect. The trooper was shot during the exchange.

The trooper was taken to a local hospital by a Frisco police officer. As of Saturday morning, Texas DPS said the trooper is doing well and is recovering at the hospital after having successful surgery

Cahill kept himself inside an apartment, which led to the hours-long standoff from Friday afternoon to early Saturday morning.

Residents of the complex were asked to either stay in their units or to stay away from the area during the duration of the standoff.

Texas DPS said Cahill fired multiple shots at officers during the standoff, but there were no further injuries to authorities. A resident shared video of moments during the standoff where the SWAT could be seen going up stairs in an attempt to arrest the suspect.

Eventually, SWAT teams were able to take Cahill into custody just after 5 a.m. He was taken to a hospital to treat serious injuries.

Cahill was then taken to Collin County Jail and charged with aggravated assault on a police officer.

“There were multiple agencies involved in this incident including Frisco Police, McKinney Police, Richardson Police, Plano Police, Little Elm Police, the FBI and others,” Texas DPS spokesperson Lonny Haschel said in a statement. “Through the efforts of outstanding law enforcement cooperation, this incident has been safely brought to an end.”

No further details on the incident were provided as authorities continue to investigate.

Apartment residents were slowly allowed back to their units with help from Frisco police.