MACAO, Portugal (AP) — Firefighters in Portugal on Tuesday brought a huge wildfire under control after the blaze raged for four days, injuring 39 people and leaving a trail of destruction.

Around 1,000 firefighters were keeping watch over smoldering hotspots in the fire-prone area, amid gusting winds and temperatures close to 40 degrees Celsius (104 degrees Fahrenheit), Civil Protection Agency commander Luis Belo Costa said.

Hilly terrain and dense pine and eucalyptus forests had slowed the emergency response to the fire, centered in the district of Castelo Branco, 200 kilometers (about 125 miles) northeast of Lisbon, Belo Costa said.

In the aftermath, dozens of charred houses, farm buildings and burned-out vehicles punctuated the picturesque landscape.

These hillsides coated with the deep green of forests draw tourists every summer. But they have long been vulnerable to fire.

Experts say Portugal needs to develop a more diversified "mosaic" of tree species, some of them more fire-resistant than pine and eucalyptus.

But those trees provide livelihoods for local people who earn cash from logging and allied businesses.

Eucalyptus also goes to Portugal's important paper pulp industry, which last year posted sales worth 2.7 billion euros ($3 billion).

Around Macao, a town of some 2,000 people, 53-year-old Fernando Fernandes wanted to save his pine trees but he and his wife were fortunate to escape with their life as the flames bore down.

"I almost died here with my wife, because of these pine trees, the wind was so strong, it really was a close call for us, really close," he said.

"In 2017 everything burned here and wood prices went down and so I was holding out to recover, but now nothing escaped (the fire)," he said. "I had so many good thick pine trees for wood but now, all gone."

Fernando Goncalo Luis and his wife Sueli left southern Brazil 13 years ago for a quiet life in the Portuguese countryside. But this week, they faced deadly nature as they tried to rescue some of their eucalyptus plantation and stored logs.

Fernando said that "when the fire came we didn't want to lose all of our month's hard work, so we faced it without even thinking of the consequences."

Fernando cleared a buffer zone with his tractor, then the couple grabbed eucalyptus branches to beat the flames back.

"Afterward, when it's all over, we thought, maybe we shouldn't have done that," he said.

Wildfires are a common summer scourge in these parts.

In the nearby area of Vila de Rei, a town of around 3,000 people near where this week's blaze began, wildfires in 1986 and 2003 charred some 80 percent of the local forest, snatching away many livelihoods, according to the local parish council.

Those disasters prompted many young people to leave the area, the parish council says. Nowadays, one third of Vila de Rei's population is older than 65. Many have neither the strength nor the financial means to keep the woodlands clean of fire-fueling debris.

Portugal, a victim of its poor forest management, has long been the southern European country where most wildfires occur.

Climate change has become another challenge for the country, bringing hotter, drier and longer summers.

Since 2010, the country has witnessed on average some 20,000 wildfires a year of varying sizes.

At least 106 people were killed in Portugal's worst fire season in 2017.

____

Hatton reported from Lisbon.

Copyright 2019 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.