A 9-year-old boy in Germany thought he found a “safe” place to hide during a game of hide-and-seek, but he ended up being locked in the security vault.

The boy was at his grandfather’s house in Berlin on Friday and was playing the game with his little brother when stumbled upon the empty safe, Sky News reported. He crawled into the box, but the door closed and locked him inside.

Family members found the 9-year-old in the metal vault, but couldn’t unlock the door because they didn’t know the code. The grandfather, who was the only person who knew the six-digit number, was away from the home at the time, according to Sky News.

The family called firefighters, who typed in every possible combination to unlock the door. Firefighters pumped oxygen through a crack into the safe to help the boy.

Three hours later, firefighters were about to break the safe open when someone finally cracked the code and freed the boy.

The child was “fine and well,” the Berlin Fire Department tweeted on Friday. Berlin firefighter Thomas Kirstein called the rescue an early Christmas present.