Lucas Ransom was surfing Friday morning between 50 and 100 yards offshore at Surf Beach, which is in Vandenburg Air Force Base, north of Santa Barbara, when the shark reared up out of the waves, pulled him under and bit off his leg, witnesses said.

Because of recent storm weather, the water was murky and the shark could have mistaken Ransom for its normal prey, shark expert Ralph Collier told ABC Los Angeles station KABC-TV.

"That would be like you and I trying to see out of our windshield in our car in a heavy fog, and a young man in a boogie board could have replicated or represented a seal or sea lion to this shark," he said.

Ransom, who was a junior at University of California-Santa Barbara, majoring in Chemical Engineering, worked at a Murrieta, Calif., community pool as a lifeguard in 2007 and was honored by the city when he and two other lifeguards saved a young boy's life.

According to witness accounts, the shark that attacked him Friday gave him no chance to save his own life.

"When the shark hit him, he just said, 'Help me, dude!' He knew what was going on," Matthew Garcia, a friend who was surfing with Ransom, told The Associated Press. "It was really fast. You just saw a red wave and this water is blue, as blue as it could ever be, and it was just red, the whole wave."

Garcia, who told the The Associated Press he was just two feet away when the shark attacked, said he searched for Ransom's body but couldn't find his friend in the murky, bloody surf. Only after he started swimming for shore did he see Ransom's boogie board pop up, and then he saw his body.

He said he tried to revive Ransom as he brought him to shore.

"Apparently the friend of the victim saw his buddy go underwater for a brief period of time and then was able to bring his friend back to shore," Vandenburg spokesman Jeremy Eggers said.

Shark Kills Surfer off California Beach

"He was just floating in the water. I flipped him over on his back and underhooked his arms. I was pressing on his chest and doing rescue breathing in the water," Garcia said. "He was just kind of lifeless, just dead weight."

Ransom was pronounced dead after further efforts to revive him on the beach, Eggers said.

"To hear that a sad thing happened to him was just like a heartbreak, you know," said Brittany Holland, a good friend of Ransom's. "He was the happiest kid in the world."

Though officials have not identified the type of shark, witnesses described it as being 14 to 20 feet in length.

Officials at Vandenburg Air Force Base released photos of the victim's bodyboard, which had a one-foot section torn out by the shark.

There have been frequent shark sightings at the beach, but attacks have been extremely rare.

The last shark attack at Surf Beach was in 2008 when a shark bit a surfer's board, but the surfer was not injured, according to ABC Santa Barbara affiliate KEYT-TV. The last fatal shark attack happened in 2003 at Avila Beach.

As a result of the attack, officials closed three beaches in the area -- Surf, Wall and Minuteman -- for 72 hours.

Last year there were 28 unprovoked shark attacks recorded in the United States, and none were fatal. The last fatal attack occurred in 2008 off the San Diego coast.