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