(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.
"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.
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.
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.
"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."