ROSTOV-ON-DON, Russia — A suicide bomber blew himself up as policemen in southern Russia gathered Sunday for the funeral of a slain colleague, killing at least seven of the policemen and badly wounding 12 other people, investigators said.

The funeral was held at the home of an officer who had been shot dead the night before by militants in Ingushetia, one of the predominantly Muslim republics in Russia's restive North Caucasus region.

In the nearby republic of Dagestan, two masked gunmen burst into a Shiite mosque during Saturday evening prayers and opened fire, wounding eight people, police said.

Shiites are a minority in Dagestan and throughout the North Caucasus, where an Islamic insurgency has raged for years.

The latest attacks took place as Muslims in Russia and around the world prepared for the feast that celebrates the end of the holy month of Ramadan.

Police investigating the shooting at the mosque in the city of Khasavyurt found a large homemade bomb and were able to defuse it Sunday morning, Dagestan police spokesman Vyacheslav Gasanov said. Militants have often rigged explosives to go off as police respond to a shooting or other attack.

In Ingushetia, Gov. Yunus-Bek Yevkurov said the militants had killed the police officer in the town of Malgobek to set up the suicide attack at the funeral the next day.

In Chechnya, where the Islamic insurgency began during separatist wars in the 1990s, four policemen were killed late Friday when their vehicle was attacked by gunmen firing Kalashnikov automatic weapons.

The insurgency in Chechnya has been largely suppressed by a Kremlin-backed local strongman, Ramzan Kadyrov, although attacks on law enforcement officers still occur periodically.

In Moscow, an estimated 170,000 to 190,000 Muslims gathered to celebrate Eid al-Adha, known in Russia as Kurban-Bairam. This included 90,000 who knelt shoulder to shoulder outside the city's main mosque near the Olympic stadium. At least 2 million Muslims, most of them labor migrants from the North Caucasus and elsewhere in the former Soviet Union, live in the Russian capital, which has a population of 11.5 million.

___

Arsen Mollayev in Makhachkala, Russia, and Lynn Berry in Moscow contributed to this report.