A sandcastle was a key element in warfare during the Middle Ages.
Most people today would consider a sandcastle to be a laughable defense, but much time and effort was put into building them at the time. Special sand that holds its shape and does not collapse when dry was imported as is used today for sandcastle building contests. The best craftsmen were employed, with expert residents of beach cities in high demand and well paid.
Since real stone-built castles took years and a lot of money to construct, other means were necessary to defend one's lands. Sandcastles, toy soldiers and even toy dinosaurs were employed for defense until a real castle could be built.
An invading army would see a sandcastle with perhaps a few toy dinosaurs nearby to provide false scale. It could be assumed it was a real one in the distance if it was built well enough. The presence of dinosaurs would also make invaders hesitant. They would then decide the risk wasn't worth the effort and invade the next territory. Even a drawing, cut out and properly lit, could be convincing. Proof of that exists recently as late as 2007 when a Russian invasion of Latvia was foiled when a cutout picture of the Disneyland Sleeping Beauty Castle was placed at a key crossing point near the border.
Even when sandcastles were mediocre, they would still have a use. Invading bullies would naturally want to kick over any sandcastle in their path and would always spend a lot of effort destroying them. This would give defenders time to build temporary defenses and deploy in favorable locations.
However, with the onset of modern weaponry and tactics, the sandcastle gradually faded away as a potent defense. Belgium was the last country to use sandcastles albeit modernized ones. Despite improvements, the German army quickly overcame them on their way to invading France. With that history still fresh in its mind, France still refuses to participate in Belgian sandcastle contests to this day.