A gunman opened fire inside a Detroit police precinct on Sunday, wounding four officers including a commander before he was shot and killed by police, authorities said.

The gunman walked in through the precinct's revolving door shortly after 4 p.m. and opened fire indiscriminately at officers, police said. The officers fired back, killing the gunman.

"Utter chaos and pandemonium took place," Police Chief Ralph Godbee said at a news conference. "We have a number of officers who are shaken up."

Godbee said the gunman has been identified but it was "too early to characterize" him while the investigation was ongoing.

The chief said along with the commander, two sergeants and an officer were wounded, but none appeared to have life-threatening injuries.

The commander, who was shot in the back, appeared to be the most seriously wounded. Godbee said he underwent surgery Sunday evening and his prognosis was "very good." A sergeant and an officer who each suffered graze gunshot wounds to the head were both talking and alert, Godbee said.

A female sergeant also was treated and released after her bullet-resistant vest deflected a bullet to the chest, Godbee said.

Detroit police precinct shooting 9 Gallery: Detroit police precinct shooting

Police also did not immediately release the names of the wounded officers, saying families had not been notified in all cases.

While the department was "very sobered" by the shootings, Godbee said he was "just very relieved that it appears all of our officers are going to be OK."

The one-story brick building is located along the main street in what is a predominantly business district on the city's northwest side. After the shooting, city and state police squad cars converged on the scene, and an ambulance was seen taking away at least one victim.

Like other precincts in the city, there are no metal detectors at the entrance and visitors are permitted to come in and talk face-to-face with police sitting behind a large, rounded desk.

"We have to take a step back and look at security at each of our facilities . . . as far as we screen our public when they come in," Godbee said.

Retired police Sgt. David Malhalab told The Associated Press that after the Sept. 11 terrorist attacks, the precincts added hand-held metal detectors at the public entrances. He worked at the 6th precinct for years and says the desks are open once you walk in the door.

"I was always very comfortable working the desk because I wanted that one-on-one feeling with the public, but I thought it was an accident waiting to happen and it did," said Malhalab, who spent 23 years on the force and retired in 2005.

Several officers leaving the precinct Sunday night declined to comment about the shooting.

"It's very somber mood, the officers are still somewhat shocked that this happened," said the Rev. Jerome Warfield, chair of the Detroit Police Board of Commissioners, who visited the precinct with other members of the board after leaving the hospital where the wounded officers were being treated.