Two suspects are in custody, one of whom was shot and is receiving medical treatment, according to police.
Police identified the officer who was fatally shot as Sgt. Wytasha Carter, 44, a member of the department since 2011. The names of the wounded officer and the suspects were not immediately released.
Birmingham Police Chief Patrick Smith said the officers had approached the two suspects just before 2 a.m. outside a downtown Birmingham nightclub, after a plainclothes officer spotted one of them checking door handles on cars parked outside the venue. Smith said one suspect opened fire after being confronted by the officers.
"This is one of the roughest hours of your career," Smith said at a news conference, according to local media reports. "There's not a chief, not an officer that ever wants to have to deal with this. This is a very difficult thing for the family, very difficult for the department."
Officers were working a special detail in response to a rash of car break-ins in that area. When the undercover officer spotted suspects who appeared to be testing door handles on cars, he called for backup and Carter arrived, officials said.
"The officers approached one suspect and patted him down where they found what they believed to be a weapon," Smith said. "They asked him about it, he armed himself and fired upon our officers."
Smith added: "It appears our officers were unable to respond. They were taken completely by surprise. We can't go into great detail because we are still in the infancy stage of the investigation."
Carter began his law enforcement career in 2002 as a correctional officer with the Shelby County Sheriff's Office and worked for two other police departments before transferring to the Birmingham department. He was promoted to sergeant in February 2018.
News outlets said Carter is the first Birmingham officer killed in the line of duty in more than 14 years.
Birmingham Mayor Randall Woodfin called for prayers on Twitter.
"Join me in praying for the family of the Birmingham Police officer killed early this morning, and the officer who is currently in the hospital. They were shot while serving and protecting our city," he tweeted.
U.S. Attorney Jay E. Town issued a statement calling the shooting "a heartbreaking reminder of the dangers all law enforcement face while we sleep."
News outlet al.com reported that law enforcement colleagues of the slain officer later Sunday saluted a mortuary transport van as it carried the fallen officer's body to a local coroner's office. Several police cruisers provided escort for the transport.
A fellow Birmingham colleague, Officer Jordan Campbell, called Carter a great officer who was devoted both to his work and family.
"Every time I found myself getting into a dangerous situation, I'd look up and he was always there," Campbell told al.com.
The media outlet said Carter was one of several officers who responded in April 2016 to a home where a roof and chimney had collapsed, trapping two young children in the rubble. He and the other officers were later honored for the rescue, the report said.
Copyright 2019 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.