COLORADO SPRINGS, Colo. (AP) — A gunman burst into a Planned Parenthood clinic and opened fire, launching several gunbattles and an hourslong standoff with police as patients and staff took cover under furniture and inside locked rooms. By the time the shooter surrendered, three people were killed — including a police officer — and nine others were wounded, authorities said.

For hours, police had no communication with the shooter other than intermittent gunfire from inside the Colorado Springs clinic. As the standoff progressed, officers inside the building herded people into one area and evacuated others.

Officers eventually moved in, shouted at the gunman and persuaded him to surrender, police said. About five hours after the attack started, authorities led away a man wearing a white T-shirt.

Police identified him as 57-year-old Robert Lewis Dear of North Carolina. Jail booking records indicate Dear is due in court on Monday.

No other details about the suspect were immediately available, including whether he had any connection to Planned Parenthood.

“We don’t have any information on this individual’s mentality, or his ideas or ideology,” Colorado Springs police Lt. Catherine Buckley told reporters.

Planned Parenthood said all of its staff at the clinic was safe. The organization said it did not know the circumstances or motives behind the attack or whether the organization was the target.

The University of Colorado in Colorado Springs police department identified the officer killed as 44-year-old Garrett Swasey, a six-year veteran of the force. He was married and had a son and daughter, according to the website of his church, Hope Chapel in Colorado Springs.

There were no immediate details about the two civilians killed in the attack. Five officers and four others were hospitalized in good condition, police said.

“Certainly it could have been much, much worse if it were not for the heroism of our police officers to corner the person in the building,” Colorado Springs Fire Chief Chris Riley said.

Witnesses described a chaotic scene when the shooting first started just before noon.

Ozy Licano was in the two-story building’s parking lot when he saw someone crawling toward the clinic’s door. He tried to escape in his car when the gunman looked at him.

“He came out, and we looked each other in the eye, and he started aiming, and then he started shooting,” Licano said. “I saw two holes go right through my windshield as I was trying to quickly back up and he just kept shooting and I started bleeding.”

Licano drove away and took refuge at a nearby grocery store.

“He was aiming for my head,” he said of the gunman. “It’s just weird to stare in the face of someone like that. And he didn’t win.”

Inside, terrified patients and staff hid wherever they could find cover. Jennifer Motolinia ducked under a table and called her brother, Joan, to leave him final instructions for the care of her three children in case the gunman found her.

Joan Motolinia said he could hear gunshots in the background as his sister spoke. “She was telling me to take care of her babies because she could get killed,” he said.

For others, the first sign that something was wrong was when police officers appeared and ushered people to the building’s second floor. Planned Parenthood employee Cynthia Garcia told her mother, Tina Garcia, that the officers wouldn’t say why they were gathering everybody together — then she heard the gunshots.

Her daughter and the others were holed up there for hours while the standoff continued, Tina Garcia said.

Some people managed to escape the building and flee to a nearby bank. An armored vehicle was seen taking evacuees away from the clinic to ambulances waiting nearby.

With the immediate threat over, authorities swept the building and turned their attention to inspecting unspecified items the gunman left outside the building and carried inside in bags. They were concerned that he had planted improvised explosive devices meant to cause even more destruction. As of late Friday, police did not say what was found.

Additional Resources

Officer Garrett Swasey Memorial Fund

By SADIE GURMAN, Associated Press … Associated Press writers Kristen Wyatt in Colorado Springs, Alina Hartounian in Phoenix and Colleen Slevin, Dan Elliott and Thomas Peipert in Denver contributed to this report.

(© Copyright 2015 The Associated Press. All Rights Reserved. This material may not be published, broadcast, rewritten or redistributed.)