A swimmer was bitten Saturday by a juvenile great white shark that grew agitated trying to free itself from a hook a fisherman had thrown into the water off Southern California's Manhattan Beach Pier, officials said.

The man, who was with a group of long-distance swimmers when he swam into the fishing line, was bitten on a side of his rib cage around 9:30 a.m., said Rick Flores, a Los Angeles County Fire Department spokesman. The man's injuries were not life-threatening and he was taken to a hospital conscious and breathing on his own, Flores said.

Witnesses said the approximately 7-foot shark was thrashing around in the water for more than 30 minutes before biting the swimmer about 300 yards off the beach.

Eric Martin told KABC-TV that the shark's mouth opened and closed as if it was trying to shake the hook.

"We think the swimmer just happened to be at the wrong place at the wrong time," Martin said.

The fisherman cut the line, and a surfer put the injured swimmer on his board, taking him ashore with the help of Los Angeles County lifeguards. Paramedics began treating the man.

The victim's identity was not released. Flores described him as a middle-aged man.

The shark remained in the area for the next 20 minutes and then disappeared into the murky water, Flores said. The beaches remained open, but a mile-long stretch was temporarily off-limits to swimmers. Police also prohibited fishing from the pier until Tuesday as a precaution.

Shark sightings are on the rise at some Southern California beaches, especially in the waters off Manhattan Beach, which is a popular spot for surfers and paddle boarders. The beach also attracted large crowds on the holiday weekend.

"There's a sighting almost on a daily basis out here," Flores said.

Marine biologists say many of the sharks are juveniles learning to feed and fend for themselves.

Capt. Tracy Lizotte, a Los Angeles County lifeguard at the beach, told the Los Angeles Times that sharks usually avoid people and said the animal accidentally bit the swimmer because it had gotten agitated.

Shark attacks are rare. Since 1950, there have been 101 great white shark attacks on humans off California -- 13 of them resulted in deaths, the state Department of Fish and Wildlife said.

It's illegal to fish for great white sharks. It wasn't immediately clear whether the department was investigating the accident. A call to a department spokeswoman wasn't immediately returned.