Baltimore police officers responding to the sound of gunshots near an apartment building fatally shot a man who fired at them with an AR-15-style rifle, authorities said early Friday.

No officers or anyone else was wounded in the shooting Thursday night in a neighborhood on the city's west side, police spokesman T.J. Smith said. He added that it wasn't immediately clear why the man had started shooting.

Four plainclothes officers riding in an unmarked Nissan Altima with the windows rolled down heard gunfire coming from the building about 9:30 p.m. Thursday, Smith said at a news briefing. The officers drove toward the sound and when they arrived, they saw a man shooting an AR-15-style weapon, according to Smith.

Smith said the man started firing toward the officers, and two returned fire.

The suspect was shot at least once and retreated to the apartment building, where he was found on the second-floor landing, according to the spokesman. He didn't immediately identify the officers, the man or the races of those involved. Smith held up a picture of what he said was the rifle that was recovered afterward.

The shooting comes a week after police shootings of two black men, one in Louisiana and the other in Minnesota, stoked outrage among many in the African-American community and protests around the country. Tensions also were heightened in the U.S. by last week's killing of five police officers in Dallas by a black gunman.

Smith said the early shooting scene was chaotic as officers drove toward the sound of the gunfire.

Officers, who Smith said initially thought there might have been more than one suspect involved, surrounded the building and searched the area. He said authorities found the gun in a tree line just behind the apartment complex and the suspect inside on the second level with at least one bullet wound to his upper body.

The man was taken to a hospital, where he was pronounced dead, Smith said.

He said police still have many questions so early in the investigation.

"We don't have a victim ... No one has come forward and said, 'Hey, I was being shot at,'" he said.

The possibility that the man was trying to lure officers to the scene with the gunfire is a "theory" police are looking into, Smith added.

"Officers were drawn due to gunfire; were they specifically drawn there by him if they might have known they were in the area? We don't know the answer to that yet, but that's something that we're trying to figure out," Smith said.

While the officers were in plainclothes, they also were wearing outer tactical vests that were marked "police" on the front and back, he said.

Smith said the crime scene processing would take several hours and he asked anyone in the area at the time of the shootings to come forward and speak with investigators. He added that he expected more information to be released later in the afternoon.

"There are a number of shell casings from this AR-15-style weapon on scene," he said.

Smith also said the two officers who fired their weapons were being placed on administrative duties as is routine in such cases.

This isn't the first police shooting in Baltimore involving someone armed with a semi-automatic rifle. In March, a man and his 18-year-old son died after police say plainclothes officers opened fire on them when they found them aiming guns at someone across a street. Police said special operations unit officers were patrolling in an unmarked car when they happened upon Matthew Wood Jr. and his son, Kimani Johnson, who had gotten out of a vehicle and were armed with a semi-automatic rifle and a handgun.