Many cases of narcolepsy are thought to be caused by a lack of a brain chemical called hypocretin (also known as orexin), which regulates sleep.
The deficiency is thought to be the result of the immune system mistakenly attacking parts of the brain that produce hypocretin.
But a lack of hypocretin is not the cause in all cases.
Normally, antibodies are released by the body to destroy disease-carrying organisms and toxins.
When antibodies mistakenly attack healthy cells and tissue, it's known as an autoimmune response.
In 2010, scientists in Switzerland discovered that some people with narcolepsy produce antibodies against a protein called trib 2.
Trib 2 is produced by an area of the brain that also produces hypocretin. This results in a lack of hypocretin, which means the brain is less able to regulate sleep cycles.
These research results may help explain the cause of narcolepsy in many cases, but it does not explain why some people with the condition still produce near-normal levels of hypocretin.
A number of factors may increase a person's risk of narcolepsy or cause an autoimmune problem.
Research is yet to confirm whether all of these play a role in narcolepsy.
Research carried out in 2013 found an association between the flu vaccine, Pandemrix, which was used during the swine flu epidemic of 2009-10, and narcolepsy in children.
The risk is very small, with the chance of developing narcolepsy after having a dose of the vaccine estimated to be around 1 in 52,000.
But Pandemrix is no longer used in the UK for flu vaccination.
The total time someone with narcolepsy spends sleeping is not necessarily different from that of people who do not have the condition.
But narcolepsy can significantly affect sleep cycles and decrease the quality of sleep.
Sleep is made up of cycles of different brain activity known as non-rapid eye movement (NREM) and rapid eye movement (REM).
During REM sleep, your brain activity increases and you may dream. Normal sleep starts with 3 stages of NREM sleep at first, followed by a short period of REM sleep.
NREM and REM sleep then alternates throughout the night. During the latter part of the night, REM sleep is more prominent.
If you have narcolepsy, this pattern is much more fragmented and you may wake several times during the night.
You may also experience REM sleep much earlier than normal after falling asleep, and the effects of REM sleep, such as dreaming and paralysis, while you're still conscious.
Narcolepsy can sometimes be the result of an underlying condition that damages the areas of the brain that produce hypocretin.
For example, narcolepsy can develop after:
Narcolepsy resulting from an identifiable underlying condition is called secondary narcolepsy.