LOS ANGELES — A 7-foot great white shark bit a swimmer off the coast near Manhattan Beach in Southern California on Saturday, leaving the man with moderate injuries, a fire department official said.

The shark bit the long-distance swimmer in the upper torso and immediately released him, said Inspector Rick Flores, a spokesman for the Los Angeles County Fire Department, which provides lifeguard services in the area.

The man was taken to a local hospital and was breathing and alert with a moderate wound, Flores said.

Lifeguards barred swimmers from entering the water for a mile-long stretch around where the attack occurred, and they watched the shark until it swam further out into the ocean, he said.

Story continues below advertisement.

Shark attacks are rare in ocean waters off Southern California, and the last fatal attack anywhere along the state happened in 2012 when a great white bit a surfer near Vandenberg Air Force Base in Santa Barbara County.

In the latest incident, a fisherman standing on a nearby pier had been battling the shark on a line for more than 30 minutes when he saw it bite the swimmer, Flores said.

The fisherman cut the line when he saw it had bitten the swimmer, Flores said. Manhattan Beach is a community about 5 miles south of Los Angeles.

People fishing in Southern California are occasionally known to hook smaller great white sharks.