MEXICO CITY -- An American surfer was in serious but stable condition after he was attacked by a large crocodile at a popular tourist beach in Costa Rica on Friday, according to an emergency responder who credited the man's friend for fighting off the reptile with his bare hands.

Pat McNulty, who works as a consultant and is a certified trained lifeguard in Tamarindo, a northwestern town favored by surfers and eco-tourists, said the man was crossing a river with the friend when the crocodile struck.

"It was a vicious attack, and he was bitten several times in the leg as well as the head," McNulty told The Associated Press by phone from Costa Rica. "They were able to get him free, swim him to safety and then trained lifeguards responded ... and we administered first aid and called an ambulance."

Get Breaking News Delivered to Your Inbox

McNulty said he accompanied the victim, who remained lucid after the attack, to Liberia, the provincial capital, where he underwent surgery. He declined to give specifics about the man's injuries other than to say he suffered lower leg trauma and his condition was serious but stable.

"His friend saved his life ... and then we the lifeguards helped keep him alive," McNulty said. "It was a very traumatic scene, and all individuals attending him did a tremendous job."

Costa Rican media reported that the victim suffered partial amputation of his right ankle and most of his calf muscle was stripped.

McNulty said he was familiar with the man before the attack because Tamarindo is a small town where everyone knows everyone else. He declined to identify him publicly by name but described him as a surfer from Colorado who maintains a residence in the village. Family members were traveling to be with him, McNulty added.

Surfline reported that the identity of the American is 59-year-old Johnathan Becker.

The U.S. Embassy in Costa Rica said in a statement that it was aware of the case and that consular officers help U.S. citizens when they are injured overseas, but declined to comment further citing privacy considerations.

Earlier, Costa Rican press reports had said the man was from Arizona.

Community, wildlife and tourism officials met after Friday's attack to consider strategies for relocating crocodiles and making sure there's proper signage to keep people safe.

McNulty said a few months ago there was a "minor incident" in which a smaller croc bit a person.

"We live in a country where there's large crocodiles, and people take for granted that when you go into a river that you're safe," the lifeguard said. "But the fact of the matter is that you need to be aware of your environment. ... We're in their world."