ISTANBUL - A police crackdown on radical groups in Istanbul on Monday led to a five-hour shootout with a leftist militant who hurled explosives and opened fire from an apartment building.

Three people were killed and eight others injured, the government said.

The militant attacked police as they closed in on him during a police sweep against leftist, Kurdish and other radical groups operating in the city. Police rounded up more than 40 people in 60 overnight raids, and the governor of Turkey's largest city said the suspects were planning "sensational armed attacks soon."

The gunman identified by the government as Orhan Yilmazkaya, a top member of the leftist group Revolutionary Headquarters, was killed along with a police officer and an onlooker in the shootout in a residential area of the Bostanci district, on the Asian side of Istanbul.

Seven police officers and a television cameraman were wounded, Interior Minister Besir Atalay said.

The militant had a large amount of ammunition and was able to hold off hundreds of officers for more than five hours, Istanbul Gov. Muammer Guler said.

Police are on alert for possible clashes with leftist militants on May Day, which falls on Friday. Last week, Turkey declared May Day a public holiday, bowing to pressure from labor unions, but it said it would not allow festivities to take place at a main Istanbul square. Several unions have vowed to defy the ban and march there.

Eleven other members of the Revolutionary Headquarters group, believed to be linked to the separatist Kurdish rebels, the Kurdistan Workers' Party, or PKK, also were detained in the overnight raids, Atalay said.

"It is a leftist group which is also linked to the separatist group," Atalay said without elaborating.

The link between the militant group and the PKK was not clear. However, the PKK was born out of Marxist ideology and has collaborated with leftist groups in the past. Turkey has been separately battling the Kurdish rebels and dozens of leftist groups for decades.

Atalay said the group had carried out attacks on military targets and the ruling Justice and Development Party office in Istanbul in the past.

The group was responsible for a failed mortar attack on a military barracks in Istanbul last year as well as a bomb attack on the ruling party's office in December, said Kanal D, a Turkish television station. It said the group was formed two years ago by militants who were trying to revive a Marxist organization that was active in Turkey in the 1970s.

The station said Yilmazkaya was a graduate of Ankara University's prestigious political science department, had briefly worked as a journalist, and had disappeared two years ago after telling family he was traveling to Latin America.

Gov. Guler said the group had been under surveillance for some time. "They were planning to stage sensational armed attacks soon," Guler said. "We have seized lots of weapons, bombs and booby traps."

At the scene of the shootout, an apartment used as a safe house, the militant threw a bomb at police when they moved in at dawn, and a second explosion was caused by a booby trap, Guler said. These caused the police casualties.

The militant then fired from behind a window curtain riddled with bullet holes. One shot grazed the head of a TV cameraman and hit an onlooker, killing him.

Thick smoke billowed from the apartment block and police helicopters hovered over the site.

Yilmazkaya had a police radio and identified himself as a fighter from the Revolutionary Headquarters during a radio conversation with the police, which was broadcast on HaberTurk television.

"I am a fighter and will fight until the end," the militant said. "I will probably be killed, but our struggle against fascism, terrorism will go on as it did in the past."

The gunman talked about the "brotherhood of people," a term used by leftists to describe their solidarity with Kurds.

The intensity of the clash terrified residents as police brought in more reinforcements and armored vehicles, ambulances, fire trucks and helicopters.

Civilians peered from windows as anti-terrorism police ducked and sheltered behind armored vehicles. Police fired several tear gas canisters that set a fire.