– King Juan Carlos of Spain said Monday that he was abdicating in favor of Crown Prince Felipe, his 46-year-old son, explaining in an address to the nation that it was time for a new generation to “move to the front line” and take on the country’s challenges.

The king’s abdication, after nearly four decades on the throne, follows health problems but also comes amid a decline in his popularity, particularly as a result of a corruption scandal centering on his son-in-law that has also put the spotlight on the family’s lifestyle and finances at a time of economic crisis and record joblessness.

‘Tireless defender of our interests’

Juan Carlos said he resolved to abdicate in January, when he turned 76. He said a generational change would open “a new chapter of hope” for a country hit by a deep economic crisis, while insisting that his son “represents stability,” for Spain, as well as for the monarchy.

The king’s son, who will become King Felipe VI, is regarded as relatively untouched by his family’s scandals. Even before Monday’s announcement, Felipe, who studied international relations at Georgetown University, had increasingly replaced his ailing father on ­diplomatic trips and at official events.

The king’s abdication was made official earlier Monday by Prime Minister Mariano Rajoy, who called Juan Carlos a “tireless defender of our interests.” The government is set to meet Tuesday to discuss the legislative change required for the handover to Felipe, which Rajoy said would happen “very soon.”

Rajoy also called the abdication “proof of the maturity of our democracy,” a message that was echoed by the leaders of Spain’s other mainstream parties. However, some far-left politicians said Spain should debate whether to maintain its monarchy.

Juan Carlos came to the throne in 1975, after the death of Gen. Francisco Franco. He was credited with playing a key role in consolidating Spain’s return to democracy, particularly when he helped avert a military coup in 1981 by making a televised broadcast calling on soldiers to return to their barracks.

He also has provided a sense of stability in a country confronting separatist efforts in the Basque region and in Catalonia. Such efforts have recently gained momentum in Catalonia, where governing parties want to hold an independence referendum in November.

‘We can all fit in’

Juan Carlos has defended Spain’s unity, saying in December, shortly after Catalan politicians unveiled their referendum plan, that the monarchy wanted a Spain in which “we can all fit in.”

The king’s reputation has been tainted by questions about the spending habits of his 48-year-old daughter, Princess Cristina, and her husband, Iñaki Urdangarin, the duke of Palma, after a judge opened a corruption investigation.

The royal family’s public standing fell sharply during the period of turmoil after the 2008 financial crisis, which also encouraged Spain’s media to drop its long-standing deference toward the monarchy and delve into the love life of the king and other previously taboo subjects.

Carmen Enríquez, who served as the royal correspondent for Spain’s national TV network, said Felipe would bring “his own style of leadership.” “The abdication is not just a banal gesture but does instead come with a broader indication of change,” she said.