TRURO, Mass. — A man swimming off Cape Cod was attacked by a shark on Wednesday and was airlifted to a hospital. It was the first shark attack on a human at the popular summer tourist destination since 2012.

The victim was a 61-year-old man, who suffered puncture wounds to his torso and legs, said Gary Sharpless, assistant harbormaster in Truro. The attack happened around 4 p.m. at Long Nook Beach in Truro, on the Atlantic Ocean side of the peninsula, he told The Associated Press.

The man was taken by a medical flight to a hospital for treatment. Truro fire chief Timothy Collins said the victim was "conscious and talking."

"We're hoping for the best," he told the Cape Cod Times.

Truro police described the shark attack as unconfirmed and did not release the victim's name or hometown. But Truro's website said the beach was closed until further notice, and workers put up signs that read, "Danger, No Swimming."

Numerous shark sightings have been reported in the area this summer, including several involving great whites, the species immortalized in the "Jaws" movies. There was no confirmation that Wednesday's attack involved a great white shark.

The newspaper said witnesses noticed the man swimming far off the beach.

The area is a feeding ground for seals, which draw sharks. Witnesses said at least 10 seals were seen in the area before the attack.

An organization that studies sharks, the Atlantic White Shark Conservancy, said shark encounters in which people are injured are as "terrifying as they are rare."

"While we still don't know all of the details of this particular bite, sharks are not known to target people specifically and when they do bite people it's usually a case of mistaken identity," the group said in a statement. "Sharks 'test the waters' with their teeth, much like we use our hands. It's how they determine if what they encounter is prey or something to avoid."

Truro was the site of the last shark attack on Cape Cod, in July 2012, when a Colorado man on Ballston Beach suffered a bite that required 47 stitches.

Massachusetts' last shark attack fatality was in 1936.