We know we are dead when we die because our brains keep working to make us aware of what's happening around us, haunting new research suggests.

Top medical experts have forever been at loggerheads over what happens when humans die, with anecdotal evidence of bright lights and flashes reported by people who have 'come back' being the cause of much debate.

However, a new study suggests your consciousness carries on functioning after your heart stops beating and your body movements fail.

CLICK ON THE SUN FOR MORE

This means you are essentially 'trapped' inside your dead body with your brain still working, if only for a short time.

Survivors of cardiac arrest were aware of what was going on around them while they were 'dead' before being 'brought back to life', the study revealed.

More surprising still, there is evidence to suggest the deceased may even hear themselves being pronounced dead by doctors.

Dr. Sam Parnia is studying consciousness after death and examining cardiac arrest cases in Europe and the US.

He says people in the first phase of death may still experience some form of consciousness.

The expert ventured that people who have survived cardiac arrest later accurately described what was happening around them after their hearts stopped beating.

He said: "They'll describe watching doctors and nurses working, they'll describe having awareness of full conversations, of visual things that were going on, that would otherwise not be known to them."

Explaining when a patient is officially declared dead, he said: "It's all based on the moment when the heart stops.

"Technically speaking, that's how you get the time of death."

His study is examining what happens to the brain after a person goes into cardiac arrest - and whether consciousness continues after death and for how long - to improve the quality of resuscitation and prevent brain injuries while restarting the heart.

Unlike the plot in Flatliners, however, when a person is resuscitated they don't return with a "magical enhancement" of their memories, said Dr. Parnia.

This story originally appeared in The Sun.