Thirty-eight have been killed after a fire raged through a psychiatric hospital outside Moscow, Russian emergency officials and media reports said.

There were believed to have been 41 people inside the one-storey hospital in the town of Ramenye when the fire broke out in the early hours of Friday, and only three managed to escape, the Emergency Situations Ministry said.

"According to preliminary reports, 38 people were killed, including two medical staff," said spokesman Oleg Salagai, cited by the RIA Novosti news agency.

Yuri Deshevih from the Emergency Ministry told RIA that at the beginning of 2012, "primary inspections discovered routine violations: no lampshades on lamps, exit signs were not everywhere, difficult reach fire water supply.

"In August 2012, they had a re-inspection - all violations had been corrected."

Moscow declared April 27 to be a day of mourning.

“The nearest fire station is about 51 km from the site. The firefighters could have arrived earlier if the fire occurred in summer, as there is a ferry across the river,” Vadim Belovoshin, deputy emergencies chief for the Moscow region, told RIA Novosti.

The fire was said to have been caused by a short circuit.

There were bars on the windows, and some patients apparently died while trying to make it to the main entrance to escape, but many others died in their beds, an unnamed source said.

The fire was the latest tragedy to hit a medical institution in Russia which still suffers from outdated Soviet-era infrastructure.

In May 2007 two people died and 12 were injured in a village psychiatric hospital in Russia's southern Rostov region.

In December 2006, a fire in a Moscow drug rehabilitation clinic killed 45 women. Many of the victims were trapped by metal bars on the windows that staff could not open and an emergency exit was boarded up, officials said.

In March 2006, a fire in a nursing home in southern Russia killed 63, also due to violations of fire safety regulations and the lack of a nearby firefighting station.

The emergency services posted a list of the patients indicating they ranged in age from 20 to 76.