King Juan Carlos I of Spain is abdicating after almost 40 years on the throne, allowing his son Crown Prince Felipe to take over as the country’s next monarch, Prime Minister Mariano Rajoy announced Monday.

The 76-year-old king, whose popularity had faded in recent years due to several corruption scandals involving his son-in-law, has been suffering from health issues and has undergone five surgeries over the last two years, which, according to media reports, could be a reason for his decision to step down. However, Rajoy reportedly said that the king was stepping down for personal reasons but did not mention when the handover would take place.

"His majesty, King Juan Carlos, has just communicated to me his will to give up the throne," Rajoy reportedly said. "I'm convinced this is the best moment for change."

The king reportedly said that he took the decision to abdicate in January and expressed his gratitude, saying: “Today a new generation must be at the forefront [of Spain]."

"Younger people with new energies [are needed] to undertake the reforms that the present juncture demands of us,” he said, according to BBC.

The king reportedly thanked his wife Queen Sofia, with whom he has three children, during the speech, saying: “My gratitude goes to the queen whose support has always been there for me.”

Rajoy reportedly said that his cabinet would soon take the necessary steps for the 46-year-old prince to take over as Felipe VI, as the country does not have specific laws regulating abdication and succession.

Juan Carlos’ daughter, Princess Cristina, and her husband, Inaki Urdangarin, are under investigation in a financial corruption case.

Juan Carlos was born in Italy, where his grandfather, King Alfonso XIII, had settled following the proclamation of the Second Spanish Republic in 1931. He was announced king in 1975, two days after the death of Spanish dictator Francisco Franco.