Traveling in the direction of the ocean, you take a gun and shoot a crab, then stick a flag in the beach and claim it as your own. The crab was the only thing standing in the way of you conquering the area. Now that the flag is in the ground, no one can dispute who it belongs to.
To make sure that no one removes your flag, you lock it to one of the lifeguard posts and you throw away the key (き). Since no one will have the key to unlock the flag, no one will be able to remove it.