The human brain still functions after death, meaning you know you are dead, new research claims.

Scientists say they have discovered that for seconds after the heart stops, brain activity still functions.

Experts say this means a patient would be fully aware of what was happening to them as their consciousness keeps working.

For a short time after death the person would be 'trapped' inside their dead body with the brain still functioning, scientists suggest.

Survivors of heart attacks were aware of what was going on around them while they were clinically 'dead' before being 'brought back to life' and could describe what was happening around them after their hearts stopped beating, the new study revealed.

Kevin Bacon and Julia Roberts stand over Kiefer Sutherland in the 1990 movie Flatliners where medical students carry out 'near death' experiments

Evidence to suggest the deceased may even be able to hear themselves being pronounced dead by doctors, researchers claim.

Dr Sam Parnia and his team from the Stony Brook University School of Medicine in New York, examined consciousness after death by researching cardiac arrest cases in Europe and the US.

He said the study found people often change when they have had this 'after-death' experience and become more willing to help others.

But unlike the plot in the movie Flatliners, which saw medial students carry out experiments by resuscitating themselves after stopping their hearts, the person does not come back to life with memories and visions, Dr Parina added.

In the 1990 film starring Kiefer Sutherland, Julia Roberts and Kevin Bacon as well as a 2017 remake with Ellen Page, the trainee doctors are haunted by visions from their past.

Brought back to life: Ellen Page has her own 'near death' experience in the 2017 remake of Flatliners

But Dr Parnia said when a person is resuscitated they do not return with a 'magical enhancement' of their memories.

Dr Parnia told LiveScience: '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.

'It [the time a patient is declared dead] is all based on the moment when the heart stops. Technically speaking, that's how you get the time of death.'

Doctors pronounce the time of death when the heart stops and when this happens, brain function halts 'almost instantly', Dr Parnia added.

But he claims that he brain's cerebral cortex, known as the 'thinking part', also slows down and flatlines, but the brain cells can still be active hours after the heart stopped.

Unlike plot of Flatliners movie, patients are not haunted by previous memories when they are resuscitated, researchers said. Pictured Julia Roberts and Kiefer Sutherland

Performing CPR on someone whose heart has stopped will send around 50 per cent of what blood it needs to the brain, which Dr Parnia says is enough to kick-start its functions.

He added: 'If you manage to restart the heart, which is what CPR attempts to do, you'll gradually start to get the brain functioning again.

'The longer you're doing CPR, those brain cell death pathways are still happening — they're just happening at a slightly slower rate.

'What tends to happen is that people who've had these very profound experiences may come back positively transformed.

Dr Parnia said when a person is resuscitated they do not return with a 'magical enhancement' of their memories, as Ellen Page does in Flatliners

'They become more altruistic, more engaged with helping others.

'They find a new meaning to life having had an encounter with death. But there isn't like a sudden magical enhancement of their memories. That's just Hollywood jazz.'

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.

The aim of the research is to improve the quality of resuscitation and prevent brain injuries while restarting the heart.