A surge of electrical activity in the brain could be responsible for the vivid experiences described by near-death survivors, scientists report.
A study carried out on dying rats found high levels of brainwaves at the point of the animals' demise.
US researchers said that in humans this could give rise to a heightened state of consciousness.
The lead author of the study, Dr Jimo Borjigin, of the University of Michigan, said: "A lot of people thought that the brain after clinical death was inactive or hypoactive, with less activity than the waking state, and we show that is definitely not the case.
"If anything, it is much more active during the dying process than even the waking state."
From bright white lights to out-of-body sensations and feelings of life flashing before their eyes, the experiences reported by people who have come close to death but survived are common the world over.
However, studying this in humans is a challenge, and these visions are little understood.
To find out more, scientists at the University of Michigan monitored nine rats as they were dying.
In the 30-second period after the animal's hearts stopped beating, they measured a sharp increase in high-frequency brainwaves called gamma oscillations.
These pulses are one of the neuronal features that are thought to underpin consciousness in humans, especially when they help to "link" information from different parts of the brain.
In the rats, these electrical pulses were found at even higher levels just after the cardiac arrest than when animals were awake and well.
Dr Borjigin said it was feasible that the same thing would happen in the human brain, and that an elevated level of brain activity and consciousness could give rise to near-death visions.
"This can give us a framework to begin to explain these. The fact they see light perhaps indicates the visual cortex in the brain is highly activated - and we have evidence to suggest this might be the case, because we have seen increased gamma in area of the brain that is right on top of the visual cortex," she said.
"We have seen increased coupling between the lower-frequency waves and the gamma that has been shown to be a feature of visual awareness and visual sensation."
However, she said that to confirm the findings a study would have to be carried out on humans who have experienced clinical death and have been revived.
Commenting on the research, Dr Jason Braithwaite, of the University of Birmingham, said the phenomenon appeared to be the brain's "last hurrah".
"This is a very neat demonstration of an idea that's been around for a long time: that under certain unfamiliar and confusing circumstances - like near-death - the brain becomes overstimulated and hyperexcited," he said.
"Like 'fire raging through the brain', activity can surge through brain areas involved in conscious experience, furnishing all resultant perceptions with realer-than-real feelings and emotions."
But he added: "One limitation is that we do not know when, in time, the near-death experience really occurs. Perhaps it was before patients had anaesthesia, or at some safe point during an operation long before cardiac arrest.
"However, for those instances where experiences may occur around the time of cardiac arrest - or beyond it - these new findings provide further meat to the bones of the idea that the brain drives these fascinating and striking experiences"
Dr Chris Chambers, of Cardiff University, said: "This is an interesting and well-conducted piece of research. We know precious little about brain activity during death, let alone conscious brain activity. These findings open the door to further studies in humans.
"[But] we should be extremely cautious before drawing any conclusions about human near-death experiences: it is one thing to measure brain activity in rats during cardiac arrest, and quite another to relate that to human experience."