Trying to ignore the rotten-eggs whiff drifting in from the shoreline, a team of municipal workers was scooping up wads of rotting brown seaweed from the beach of this Mexican beach town 40km (25 miles) south of Cancún.

But almost as fast as they could be cleared away, more clumps of algae were washing ashore, forming foul-smelling mounds across the white sands of the beach.

“You clear an area and four hours later or by the next day, it looks the same,” said Jorge Sandoval, one of the workers.

Mexico has spent $17m in an attempt to clear 500,000 tons of sargassum seaweed from its Caribbean beaches, but the problem only seems to be getting worse. And now tourists are starting to notice: hotel occupancy rates have dropped and tourism chiefs are concerned that the seaweed is threatening a key industry in the Mayan Riviera, which stretches from Cancún to the Belize border.

Scientists say the seaweed normally plays an important role in the regional ecosystem: rafts of floating sargassum provide important habitat for birds and marine species in the Atlantic, while smaller amounts of sargassum are normal on beaches and considered beneficial.

But for the past decade, sargassum has been blooming excessively across the Caribbean. The reasons remain unclear, but scientists say human activities are aggravating factors, while rising ocean temperatures are also thought to play a role.

The proliferation of sargassum has been fueled by agricultural fertilisers and untreated sewage flowing into the Caribbean and Atlantic.

Barely 30% of wastewater in Mexico’s Mayan Riviera is treated, said María del Carmen García Rivas, a biologist in Puerto Morelos with Mexico’s National Protected Areas Commission.

In turn, rotting sargassum increases the sea’s acidity and temperature and reduces oxygen, said García. The plant is also poisonous for some coral reefs, local fauna and fish.

A worker cleans a beach in Tulum, Mexico, on 15 June. Photograph: Justin Sullivan/Getty Images

“The reef is ailing because for the past 40 years we’ve been throwing nutrients into the sea – and now you’re delivering a body blow. In six months we’ve lost 30% of the reefs in the Mexican Caribbean.”

President Andrés Manuel López Obrador has downplayed the problem, while tourism secretary Miguel Torres Márquez tweeted a video of a pristine Cancún beach with the comment: “We’re looking after Cancún, ‘our blue-eyed girl’ and all the beautiful beaches of the Mexican Caribbean.”

But such optimism is harder to find on the beaches.

“Fighting sargassum is a chore every day,” Cancun mayor Mara Lezama told the AP. “You clean the beaches in the morning, and sometimes you clean them again in the afternoon or at night, and then you have to go back and clean it again.”

Officials in Puerto Morelos say they’ve been proactive – hiring cleanup crews, setting up barricades and sending a boat out to sea to scoop up sargassum. But cleaning up the sargassum inadvertently removes sand, aggravating serious beach erosion.

Cancún, Puerto Morelos – and most other major tourist resorts – are a former fishing settlements which have grown rapidly over the past 50 years – a process in which economic growth was prioritized over environmental concerns.

Tourism accounts for approximately 8% of Mexico’s GDP, but local business owners expressed concern that the sector may be threatened by the sargassum blight.

Regional occupancy rates are running behind last year’s pace and room rates have dropped nearly 20%, according to the business magazine Expansíon.

“I’ve been in business 20 years and it’s never been this slow,” said Triny Juárez, a local restaurateur. Juárez has started sending her employees to join the cleanup crews rather wait tables or prepare food. But the sargassum always seems to return with a vengeance.

“You can’t compete with nature,” she said.