A 37-year-old man was hospitalized in critical condition Sunday after nearly drowning off a crowded Mercer Island beach during Seafair festivities, police said.

The man was swimming off the shore of Groveland Beach Park — on the west side of Mercer Island across from Seattle’s Seward Park — when he “got into trouble,” said Mercer Island police Commander Jeff Magnan.

“We’re not sure exactly how or why, but he went under,” Magnan said. “Some bystanders grabbed him and pulled him out of the water and started CPR.”

Police and fire units, the city’s Marine Patrol and Dive Team, and city of Bellevue fire medics quickly responded and attempted to resuscitate the man, Magnan said.

As an ambulance was transporting the man to Overlake Medical Center in Bellevue, medics “were able to get a good heartbeat out of him and he was able to sustain it,” Magnan said.

The man was admitted to the hospital and at last check was in critical condition, Magnan said. Police had no information indicating alcohol or foul play was involved in the near-drowning, he said.