A Moscow school student shot a teacher and a police officer dead and held more than 20 other students hostage in a classroom before he was disarmed and detained, police have said.

In a rare school shooting in Russia, the attacker entered his school in northern Moscow on Monday with a rifle, and held students and a teacher hostage in a biology classroom, police in the capital said.

Police later said the attacker had been detained and had been led out of the school and into a waiting car.

According to the Lifenews website, he initially shot one police officer and then opened fire at others who arrived at the scene.

"The person who took 20 people and a teacher hostage is a student in the upper classes at the same school. He has been neutralised and all the students have been freed," said Andrei Pilipchuk, an Interior Ministry spokesman.

"One policeman was fatally wounded during the operation and died in hospital, and a teacher at School No. 263 was also killed," he said.

The shooting sent dozens of students scurrying out the school while a police helicopter landed in a snow-covered field outside.

Source: Reuters