Nightmares occur during REM sleep, but REM sleep does not cause them. Nightmares are more common during the latter half of your sleep when REM cycles are longer.