A great white shark that got stranded on a Cape Cod beach is swimming free thanks to beachgoers who kept it wet until rescuers arrived.

Witnesses say the 7-foot male shark got stuck Monday near South Beach in Chatham, Massachusetts, as the tide went out.

Beachgoers kept the shark wet by splashing it with buckets of water until officials attached a line to its rear caudal fin and Harbormaster Stuart Smith pulled it back into open waters. Officials say it took about an hour.

Smith says about 40 people were crowded around the shark when he arrived and it appeared dead.

The shark was tagged by a state shark scientist.