Ash Ketchum and his friends arrive in the scenic town of Alamos Town to participate in a local Pokémon contest, only to discover that the town is plagued by bizarre nightmares and structural distortions. They soon learn that the mysterious phenomena are caused by a clash between two legendary Pokémon: Dialga, master of time, and Palkia, master of space, whose dimensional battle threatens reality itself. Amidst the chaos, a misunderstood dark-type Pokémon named Darkrai, reviled by the townsfolk, desperately attempts to protect the town from total destruction. Ash and his companions must find a way to appease the warring legends and save Alamos Town.