Gerard Butler has been treated and released after being hospitalized in the wake of being held underwater by big waves while filming “Of Men and Mavericks” in Northern California.

The incident took place Sunday when filmmakers were shooting second-unit scenes of Butler and other surfers at the Mavericks surf break, which often sees massive sets of waves. He was held underwater after a large set of waves broke in front of him and washed ashore before being rescued.

Butler was taken by ambulance to Stanford Medical Center for examination and was later released.

“He’s fine now,” said Brooke Wilcher, a spokeswoman for producer Walden Media, on Tuesday.

Wilcher said “Mavericks,” based on the true story of Jay Moriarty’s rise to the forefront of big wave surfing, has nearly completed production. Second-unit filming was wrapped on Monday.

Butler is portraying surfer Rick “Frosty” Hesson, who trained the young Moriarty, played by Jonny Weston.

Curtis Hanson directed most of the shooting and was succeeded due to health concerns in the latter stages of production by Michael Apted. Hanson, Mark Johnson, Brandon Hooper and Jim Meenaghan are producing.

Moriarty sought to ride the iconic Northern California break known as Mavericks, where winter swells bring in treacherous waves the size of five-story buildings, and trained for more than a year under Hesson.

Fox is releasing “Of Men and Mavericks” on Oct. 26.