A Thai police officer had a remarkably lucky escape during a shootout with a gangster in a restaurant when his iPhone took the brunt of a bullet to his hip.

Sergeant Major Powaret Banjong was still recovering from the encounter in hospital on Tuesday when he shared the harrowing tale with local media. Banjong said he was dining at the same establishment as Somchai “Hia Chai” Sae-chua, 49 – a well known criminal in Pattaya – on Saturday night.

Somchai reportedly got into an altercation with a woman at his table, prompting Banjong, 31, and a fellow cop to intervene. The confrontation quickly escalated, however, when Somchai drew his pistol and began firing at the pair.

In a scene straight out of a Hollywood movie, Banjong said he leapt onto one of the dining tables and began firing back at Somchai, eventually taking a bullet to his arm and another to his upper thigh.

However, Banjong was miraculously spared the second bullet when it lodged in the iPhone he had in his pants pocket, reports Thailand Police Story. Both Banjong and Somchai were rushed to hospital with gun wounds, the latter having suffered strikes to the temple, arm, stomach and leg. He has also miraculously survived.

READ MORE: Moscow shooters test ‘bulletproof’ titanium iPhone7 (VIDEO)

This isn’t the first time that a smartphone has taken a bullet for a cop. Three years ago, a remarkably similar scenario occurred when a Thai officer was fired upon and was saved by his Samsung Galaxy Note 2, which was sitting in a case on his belt.

Blackberrys, HTCs and even older Nokia phones have also been known to get targets out of a potentially fatal pickle from time to time.

Think your friends would be interested? Share this story!