* Some killed in their beds, some trapped by barred windows
* Deaths put focus on how psychiatric patients are treated
* Russia has poor safety record, Putin demands inquiry (Adds more bodies found, investigator, fireman)
By Alexei Anishchuk
RAMENSKY, Russia, April 26 (Reuters) - Thirty-eight people were feared dead after a fire raged through a psychiatric hospital north of Moscow early on Friday, killing some patients in their beds and trapping others behind barred windows.
The fire, which raised questions about the care of psychiatric patients in Russia, swept through a single-storey building at the hospital, a collection of wood and brick huts that was home to people sectioned by Russian courts.
Officials said the blaze, which began at around 2 a.m. (2200 GMT on Thursday) was caused either by patients smoking or an electrical fault.
By mid morning, only a few blackened walls were left standing. The roof had caved in on top of the twisted metal of what were once beds. A few bodies lay on nearby grass, covered with blankets. Officials said 36 had been recovered so far.
President Vladimir Putin called for an investigation of the "tragedy", the latest in a long line of disasters at state institutions that are often ill-funded. Russia's safety record is dismal, accounting for a high death toll on roads, railways and in the air as well as at the workplace.
"Those who were in there said it happened in a flash. The nurse opened the door to the room and there was smoke, and even when she saw the fire she could not get to the fire extinguisher. It all happened very quickly," said Andrei Vorobyov, interim governor of the Moscow region.
He told Russia 24 television that a nurse had led two patients to safety. He said 36 others were believed to have been in the hospital when the fire broke out, but another local official said 38 were feared dead.
He said some windows had been barred to meet regulations while others had not.
"Obviously, all the patients were sleeping and they were sick people ... so they would have needed help to get out," he said, adding the nearest fire station was a 40-minute drive away.
But residents of the village, a cluster of wooden houses linked by dirty, dusty streets, said it was yet further evidence of how the state treats its citizens outside the main cities.
"Don't trust anyone who says they (firemen) arrived quickly ... My wife woke me up, we went out on the street with our daughter. Flames were rising high," said a man, who was drinking an early-morning beer at a friend's garage nearby.
Asked why it caught fire, Alexander Yefimovich, an elderly man said: "Why? It's just the usual nonsense."
Some relatives said conditions in the hospital were squalid.
"Living conditions? It was a slum in there. No conditions," said Konstantin, whose father was in the hospital, about 120 km (70 miles) north of Moscow.
"The majority of the bodies were found in the beds," Irina Gumennaya, aide to the head of the chief investigative department of the Moscow region, told reporters.
She said the fire was probably started by patients smoking but could also have been due to a short circuit.
Colonel Vadim Belovoshin, chief fireman and deputy head of the Moscow regional Emergency Ministry, said it would have been difficult to save them all because of their health conditions.
"Let's mention the function of this building and the reason why it was set up here: Those were specific people ... It is sometimes hard for a panicking individual to find his way out even in his own apartment. Here we have (mentally) unhealthy people, which made things more complicated."
Some people stood on the opposite bank of the Moscow canal from the hospital, trying to get across to check whether their relatives had survived. The police had stopped the ferry and fishing boats were not allowed to cross.
More than 12,000 people were killed in fires in 2011 and more than 7,700 in the first nine months of 2012 in Russia, where the per capita death rate from fires is much higher than in Western nations including the United States. (Additional reporting by Ludmila Danilova; writing by Elizabeth Piper; editing by Timothy Heritage and Philippa Fletcher)