Scott Andrew Selby / Bloomberg News

On July 28, a man hiding his face with a hat and scarf entered the world-famous InterContinental Carlton Cannes hotel in France. He passed through a set of locked French doors, pointed a gun at three security guards, two jewelers and a manager, and took $136 million worth of diamonds just as they were about to be placed in secure display cases. He then left the hotel and disappeared into the stream of people enjoying an afternoon stroll along the Mediterranean.

At first glance, the crime looked as if it was almost too easy. In the movie version, the audience might suspend belief at its seamless efficiency, even if the heist itself was preceded by scenes of the thieves’ meticulous preparation.

But multimillion-dollar diamond heists tend to be much more complicated than even the most talented screenwriter can imagine. In the Cannes case, the thief or thieves almost certainly spent weeks or even months planning the burglary to spot and exploit the flaws in the hotel’s security system.

For example, the thief — or, more likely, an accomplice — learned that the hotel’s security guards were unarmed and that the optimal time for the robbery would be in the few minutes when the jewels were being moved to their secure cases. A locked set of French doors led from the busy Promenade de la Croisette into the hotel room with the diamonds. The thief was able to open it quickly. With the proper tools and a bump key, a professional criminal could have the door open in the same amount of time it takes you to get into your house.

Unlike the fortresses of Belgium’s Antwerp, where diamonds are stored, or Kentucky’s Fort Knox, with its gold, the hotels, restaurants and stores of Cannes are set up to serve its annual film festival and summer tourists, not to protect valuables.

Yet even a place that seems impenetrable may have weaknesses.

In the 2003 Antwerp diamond heist, which Greg Campbell and I wrote about in our book “Flawless,” the thieves rented an office and a safe deposit box in the building they planned to rob and spent two years preparing for the theft. They analyzed the intricacies of every operation in the building and the surrounding area.

The thieves used hidden cameras to record footage of the locking mechanisms on the vault’s safe deposit boxes, as well as the motion, heat and light detectors. They studied the ways into and out of the building and took note of where the security cameras’ footage was routed. As they gathered intelligence, they conferred with experts in Italy who advised them on bypassing the vault’s security systems.

On one weekend in February 2003, the thieves used a crudely made key to break into the rear of the Antwerp Diamond Centre through the garage. They then got past each of the security systems until they were alone in the vault with diamonds, gold and jewelry worth almost half a billion dollars according to a Belgian detective we spoke to while researching our book.

When the building’s caretakers came in Monday morning, they found the vault’s foot-thick steel door ajar with 109 of the almost 200 boxes inside looted. The police, security personnel, management and owners were shocked. The diamonds had vanished. If a below-ground vault in Antwerp couldn’t protect its diamonds from thieves, what chance did a hotel in Cannes have?

Such high-profile heists are like a game of chess. By thinking a few moves ahead and realizing their opponent is doing the same, someone in possession of a trove of diamonds can avoid falling victim.

Security measures age quickly, and the longer they are in place, the more time thieves have to figure out ways around them. For a business to protect itself, it needs to have constantly updated, redundant systems in place.

In Antwerp, for example, those in charge of security apparently thought that the police outside with their machine guns and the thick vault doors were enough; they failed to ensure that the seemingly more minor aspects of the system were up to date.

In Cannes, diamond exhibitors learned that placing unarmed security guards behind a locked door isn’t enough to protect a fortune. A locked door may seem like an impregnable wall to a business owner who has no idea how to pick locks, but to a pro, it’s merely an inconvenience.

In “To Catch a Thief,” Cary Grant said to John Williams: “Why did I take up stealing? To live better, to own things I couldn’t afford, to acquire this good taste that you now enjoy and which I should be very reluctant to give up.” This is the reason most diamond thieves do what they do. They are out there now, scouting for their next target and searching for anyone who has grown complacent in protecting what is valuable. In short, in order to stop a thief, you have to think like one.