(CNN)-- It was a sea rescue made for Hollywood: A horse in a photo shoot on a Southern California beach gets spooked and runs into the water, only to be rescued after swimming more than two miles offshore.
That's what happened to a 7-year-old white Arabian named William, said Santa Barbara Harbor Patrol Officer Ryan Kelly.
The drama unfolded Tuesday about 6:30 p.m. when the horse bolted from the beach in Summerland, just south of Santa Barbara, and ran into the ocean.
"The initial call came in as a missing horse," Kelly said.
Several more calls followed about a horse swimming out to sea.
Rescue personnel from the nearby Carpenteria Fire Department, along with state lifeguards, took to the water to search for the horse, and a helicopter was launched by Santa Barbara County's search and rescue team.
William was spotted more than two miles offshore in the Santa Barbara Channel, swimming toward oil rigs, according to an incident report.
"Firefighters were able to hook the animal's reins with a boat hook and bring it alongside a paddleboat," the report said. Floats were put under its neck to help keep its head above water.
Photos and video taken of the rescue show Kelly and others placing a tow line under the horse's saddle and securing it to the boat. Harbor patrol personnel and lifeguards appeared to take turns holding the horse's head up.
"It took about two-and-a-half hours to escort the horse back to dry land and into the hands of a vet," Kelly said.
The horse was taken to an animal clinic in the area and released back to the owner.