The reeking carcass of a dead humpback whale was towed back out to sea some 24 hours after it washed up at a popular Los Angeles County beach on Friday.

Authorities used boats pulling ropes attached to the tail to pull the whale off the sand during the evening high tide, taking the animal far out to sea and avoiding a foul stench and grim scene on the beach as Fourth of July weekend crowds began arriving.

Authorities had attempted the procedure at midday, with a bulldozer pushing the carcass, but were unsuccessful because of the low tide.

The huge whale washed on to Dockweiler beach, a long stretch of sand near the west end of Los Angeles international airport, just before 8pm on Thursday. Holiday beachgoers began arriving in the morning.

Lifeguards posted yellow caution tape to keep people away and biologists took samples to determine what caused the death of the humpback, an endangered species. Beachgoers watching from a distance covered their noses.

Tail markings were compared with a photo database and found that the same whale had been spotted three times off southern California between June and August of last year by whale watchers who gave it the nickname Wally, said Alisa Schulman-Janiger, a whale research associate with the Natural History Museum of Los Angeles County.

At the time of the sightings, the humpback was covered with whale lice, which usually means a whale is in poor physical condition, but it was also actively feeding and breaching, she said.

Schulman-Janiger said she noticed healed entanglement scars on its tail, indicating that in the past it been snarled in some sort of fishing line. The carcass was in relatively good condition, which meant the whale could have died as recently as Thursday morning, she said.

The whale was about 46ft long and at least 15 years old, meaning it had reached maturity, said Justin Greenman, stranding coordinator for the national marine fisheries service. Skin and blubber samples were taken for DNA testing along with fecal matter to be tested for biotoxins.

The experts had hoped to more extensively open up the whale, but due to the holiday weekend, authorities decided to get it off the beach as soon as possible, Greenman said.

Girls react to the smell of the dead whale. Photograph: Frederic J Brown/AFP/Getty Images

North Pacific humpbacks feed along the US west coast from California to Alaska during summer, according to the Marine Mammal Center, a Sausalito-based ocean conservation organization. Although the species’ numbers are extensively depleted, humpbacks have been seen with increasing frequency off California in recent years, the center’s website said.

Humpbacks, familiar to whale watchers for their habits of breaching and slapping the water, are filter feeders that consume up to 3,000lbs of krill, plankton and tiny fish per day, according to the National Oceanic and Atmospheric Administration.

The whale that washed up is not the same one spotted earlier in the week off southern California tangled in crab pot lines. That animal was identified as a blue whale. Efforts by a rescue crew in a small boat to cut away the line failed, and the whale disappeared.

California has seen a number of whales on beaches this year. A humpback carcass that appeared off Santa Cruz in May had to be towed out to sea, while a massive gray whale that ended up on San Onofre State Beach in April had to be chopped up and hauled to a landfill.

The same month, a distressed humpback was freed from crabbing gear in Monterey Bay. In March, a dead gray was removed from Torrey Pines state beach.