TAMPA, Fla. (WFLA) — Authorities say a phone’s distress signal helped them rescue a man who had been trapped in a vehicle that landed upside down in a Florida canal on Wednesday, The Miami Herald reported.

According to the Martin County Sheriff’s Office, the 38-year-old was driving down a dark road at around 1 a.m. Wednesday. He swerved to avoid an animal, and crashed his vehicle into the murky canal.

The man was rescued thanks in part to a feature on his phone that detects severe car crashes.

The sheriff’s office did not say what phone the man was using, but Apple’s latest iPhone 4 and Watch Series 8 have car crash detection. So do Android phones and other apps.

When a severe crash—such as front-impact, side-impact, rear-end collisions and rollovers— is detected, your iPhone or Apple Watch will sound an alarm and display an alert on the screen. Users will have 20 seconds to dismiss the alert. If they’re unable to respond in time, emergency services will be called, and the device will share your location with a dispatcher.

The feature works on iPhone 14 and iPhone 14 Pro models with the latest version of iOS and Apple Watch Series 8, Apple Watch SE (2nd generation), and Apple Watch Ultra with the latest version of watchOS.

“Deputies located the [man’s] vehicle upside down in the water—based solely on automated longitude and latitude coordinates sent to MCSO dispatchers by the victim’s cell phone,” the sheriff’s office said on Facebook.

Body camera video shows first responders arrive at the scene and find the car upside down in the water. The man can be heard crying for help as deputies rush to his vehicle.

“Stay back from the window, buddy, I’m going to bust it,” one deputy is heard saying.

Deputies were able to pry open the door and help the shivering man out of his vehicle.

“I’m so cold … Can you give me a blanket, please sir? I’m freezing,” he said.

Investigators believe the man had been trapped for about 20 minutes. He was taken to an area hospital and was expected to recover.

According to TCPalm.com, investigators do not believe speed, drugs or alcohol were factors in the crash.

“It’s technology you may not even realize you have, but this dramatic rescue should remind you of its importance, as well as the importance of sharp dispatchers and brave deputies,” the agency said on Facebook.