A woman in Galicia, Spain, covers her face to protect herself from the smoke.
CNN  — 

At least 39 people have been killed in wildfires in Portugal and Spain, according to officials from both countries.

In Portugal, where 36 people are confirmed to have died in the blazes, three days of mourning began on Tuesday.

At least 63 people in Portugal have been injured, with 16 of those in serious condition, Patricia Gaspar, a spokeswoman for the Portuguese National Authority for Civil Protection (ANPC), told CNN.

A firefighter who was called in to help battle the flames is among those seriously ill.

Inocencia Rodrigues, 64, walks among the debris of the burnt shed where she raised chickens and pigs in the village of Sao Joaninho in northern Portugal.

“This country has been plagued with the largest wave of fires since 2006,” Portugal’s Prime Minister Antonio Costa said Monday evening. “This is a moment of mourning, of showing our condolences to the families of the victims.”

Costa promised action to prevent such large-scale fires in the future.

All active fires in Portugal had been extinguished by Tuesday morning, Gaspar said, explaining that a combination of the agency’s work and rain overnight had helped to put out the flames.

The remains of a forest destroyed by a wildfire in Vieira de Leiria, Marinha Grande, in central Portugal

Galician President Alberto Nunez Feijoo said Tuesday some fires were still burning in northwestern Spain, but none of them was considered a threat to population centers. Authorities in Galicia, where three people died, also declared three days of mourning Monday.

The fires had blazed across northern Portugal throughout the weekend before spreading across the border into Spain. Many roads and schools in Galicia were closed, with several schools used as shelters for evacuees.

The wildfires have been widely documented on social media. Instagram user @danitri77 posted a video Sunday showing a burning hillside on the outskirts of Pontevedra, Galicia.

More than 600 members of the Spanish Armed Forces were deployed to help fight the flames, including members of the 43rd Air Force Group, who shot a bird’s eye video of the fires.

Some of the fires may have been started deliberately, according to authorities in Portugal and Spain, but recent weather conditions – including low humidity and unusually high temperatures – are also believed to have played a major role.

Volunteers use a water hose to fight a fire raging near houses in the outskirts of Obidos, Portugal.

Portugal experienced its driest September in 87 years, according to the Portuguese Institute of Sea and Atmosphere (IPMA), aggravating drought conditions that may have helped the fires to spread.

By bringing warm air to the region, Hurricane Ophelia – which hit Ireland’s west coast as a post-tropical storm Monday – also fueled the blaze, according to the IPMA.

Spain’s Prime Minister Mariano Rajoy met emergency personnel working to battle the fires in Galicia on Monday, and held a minute’s silence in memory of the three Spanish victims.

Spanish Prime Minister Mariano Rajoy with emergency personnel in Pontevedra, Galicia, on Monday.

“The Government of Spain is with Galicia, its people and with the Xunta [Galicia’s regional government],” Rajoy wrote in a tweet. “Together we will beat the fire.”

Galician President Alberto Nunez Feijoo referred to the fires as “terrorist acts” in a tweet Monday. “A day like yesterday is not the result of chance,” he wrote later.

Feijoo described the situation as “difficult and complex” and thanked the firefighters for their efforts in tackling the fires.

At least 62 people were killed by a wildfire in central Portugal in June, which was described at the time by officials there as “the greatest wildfire tragedy of recent years.”

CNN’s Livvy Doherty and Barbara Arvanitidis contributed to this report.