A spokesman for the National Anti-Terrorist Committee, known as NAK, said on state television that the militants were Russian citizens who had received training along the Afghanistan-Pakistan border. They were not identified.
Russian special forces regularly announce that they have thwarted terrorist attacks, although this most often occurs in the Caucasus region of southern Russia where an Islamic insurgency is simmering. The last major terrorist attack in Moscow was a suicide bombing at the Domodedovo international airport in January 2011 that left 37 people dead.
NAK spokesman Dmitry Pavlov said special forces surrounded the building where the militants were holed up in the Moscow suburb of Orekhovo-Zuevo and ordered them to surrender, but instead the militants opened fire. He said one of the special forces was lightly wounded in the operation but no local residents were hurt.
It was not clear when the operation took place and no further information was immediately available.
Meanwhile, two bombs exploded outside a court building in Russia's restive province of Dagestan on Monday, killing at least four people and wounding dozens of others, officials said.
The first bomb exploded in a parked car and the second went off in a trash bin about 15 minutes later after police had arrived on the scene in Makhachakala, the provincial capital, according to Interior Ministry spokesman Vyacheslav Gasanov. He said the second blast, which was much more powerful, caused all of the casualties and many of those killed and wounded were police.
Health officials in Dagestan said about 45 people were taken to various hospitals for treatment. The federal Health Ministry in Moscow later said 35 people were hospitalized.
Investigators said it appeared that both explosions were set off by remote control.
Two separatist wars in Chechnya killed tens of thousands of people and spawned an Islamic insurgency that has engulfed the entire region, mainly neighboring Dagestan.
Deadly attacks on police and other officials occur almost daily.
Copyright 2013 The Associated Press.