Suspect arrested after standoff during which shots were fired.

FRISCO, Texas — A Texas Department of Public Safety trooper was shot after trying to make a traffic stop on the Dallas North Tollway on Friday afternoon, and authorities took a suspect into custody following a standoff at an apartment complex 15 hours later.

The suspect, identified as 42-year-old Bryan M. Cahill, was seriously injured after firing multiple rounds at officers, according to a news release from the DPS.

He was taken to a hospital for treatment.

The trooper was taken to Presbyterian Hospital in Plano, where he underwent surgery. He was out of surgery by 9 p.m. and "physicians say it went well," said Lt. Lonny Haschel, DPS spokesman.

Saturday morning, Haschel reported that the trooper was in good spirits.

"He will have a long recovery process," Haschel said.

The incident happened near the Dallas North Tollway and Lebanon Road, ending up in the parking lot of the La Valencia at Starwood apartments. Shortly after Frisco police said the situation was being handled as a barricaded person, a loud bang could be heard coming from the apartment complex.

Police gave an all clear to enter the apartments on Saturday afternoon.

Watch Haschel's full update on how the incident unfolded:

The trooper had tried to stop a car for a traffic violation on the Tollway, near Spring Creek Boulevard. Instead, the driver of the car fled the trooper, heading north on the Tollway to the Lebanon Road exit.

The driver then went into the nearby La Valencia at Starwood apartments and pulled over. At some point, the trooper was shot, Haschel said.

The trooper was taken by a Frisco police officer to a local hospital for treatment. He was still undergoing treatment about 5 p.m. Friday.

The suspect was still at large in the area, Haschel said. Police were asking residents to stay inside as authorities searched for the suspect.

Police had said they were responding to an "active situation" involving a trooper at a Frisco apartment complex on Friday afternoon, but few details were initially released.

On Twitter, police warned residents to stay clear of the area of the 6800 block of Lebanon Road, at the La Valencia at Starwood apartments, just off the Dallas North Tollway. Officers had shut down eastbound Lebanon, from Starwood to Dallas Parkway.

Southbound Dallas Parkway was closed south of Lebanon.

At the scene, officers could be seen standing behind a police vehicle with their guns drawn, pointed near the direction of a car that had its driver's door open. The car, a Pontiac Firebird, had three bullet holes in its back window. No one was inside the car.

An armored vehicle was at the entrance of the apartments and SWAT team members were staging in tactical gear.

Plano and McKinney police, along with the DPS and the FBI, were also at the scene helping with the investigation.

The nearby Starwood Montessori School was put on lockdown during the incident and releasing students one at a time, officials said.