Frederik X is proclaimed the new king of Denmark after his mother Queen Margrethe II abdicates

Frederik X

COPENHAGEN, Denmark (AP) — Denmark’s prime minister proclaimed Frederik X as king on Sunday after his mother Queen Margrethe II formally signed her abdication, with massive crowds turning out to rejoice in the throne passing from a beloved monarch to her popular son.

Margrethe, 83, is the first Danish monarch to voluntarily relinquish the throne in nearly 900 years. Many thousands of people gathered outside the palace where the royal succession took place, the mood jubilant as the Nordic nation experienced its first royal succession in more than a half-century, and one not caused by the death of a monarch.

Denmark’s monarchy traces its origins to 10th-century Viking king Gorm the Old, making it the oldest in Europe and one of the oldest in the world. Today the royal family’s duties are largely ceremonial.

Margrethe signed her abdication during a meeting with the government at the Christiansborg Palace, a vast complex in Copenhagen that has been the seat of Danish power for centuries. It now houses the Royal Reception Rooms and Royal Stables as well as the Danish Parliament, the prime minister’s office and the Supreme Court.

Prime Minister Mette Frederiksen next proclaimed Frederik king from the balcony of the palace before the cheering crowd.

Frederiksen read the proclamation three times, which is the tradition, as Frederik stood beside her wearing a ceremonial military uniform adorned with medals. He was then joined on the balcony by the new, Australian-born Queen Mary and the couple’s four children, and the crowd spontaneously sang the national anthem.

“My hope is to become a unifying king of tomorrow,” Frederik said. “It is a task I have approached all my life.”

It is the custom for each new sovereign to adopt a royal motto as a guiding principle for their reign, and Frederik’s is: “United, committed, for the kingdom of Denmark.”

“I want to return the trust I meet,” the new king said. “I need trust from my beloved wife, you and that which is greater than us.”

Frederik then kissed Mary, the queen, who wore a white dress with a sash over one shoulder, and another great cheer rose from the crowd.

They then left Christianborg Palace in a horse-drawn coach as church bells rang out, and headed to their Amalienborg residence, where they once again appeared before people cheering and waving the nation’s flag of a white cross on a red background.

Frederik, who was visibly moved, placed both hands on his heart in a gesture of thanks.

The abdication document was earlier presented to Margrethe as she sat at a massive table covered in red cloth around which royals and members of the Danish government were seated. Frederik sat beside her.

After signing it, Margrethe, dressed in a magenta skirt suit, rose and gestured to Frederik to take her place. “God save the king,” she said as she left the room using a cane for support.

The abdication leaves Denmark with two queens: Margrethe keeps her title, while Frederik’s wife becomes Queen Mary. Frederik and Mary’s eldest son Christian, 18, has become crown prince and heir to the throne.

Citing health issues, Margrethe announced on New Year’s Eve that she would step down, stunning a nation that had expected her to live out her days on the throne, as is the tradition in the Danish monarchy. Margrethe underwent major back surgery last February and didn’t return to work until April.

Even the prime minister was unaware of the queen’s intentions until right before the announcement. Margrethe had informed Frederik and his younger brother Joachim just three days earlier, the Berlingske newspaper wrote, citing the royal palace.

People from across Denmark gathered outside parliament, with many swarming streets decorated with red-and-white Danish flags. Several shops hung photos of Margrethe and Frederik, while city buses were adorned with small Danish flags as is customary during royal events. Many others across the kingdom of nearly 6 million people followed a live television broadcast of the historic event.

“It was worth the four hours wait,” said Anders Pejtersen, 25. He made the trip from Aalborg, in northern Denmark, to witness Frederik’s proclamation. His mother, Helle Pejtersen, said “it was intense.”

Marina Gregovic, 32, a Copenhagen resident, said she believed Frederik “will be fantastic. And we loved his speech.”

Royals across Europe sent their congratulations including U.K. King Charles III, whose late mother Queen Elizabeth II and Margrethe were third cousins.

Charles said he was committed to working with them “on ensuring that the enduring bond between our countries, and our families, remains strong.”

Earllier in the day, the royal guards’ music band made their daily parade through downtown Copenhagen, but wore the red jackets used to mark major events, instead of their usual black.

The last time a Danish monarch voluntarily resigned was in 1146, when King Erik III Lam stepped down to enter a monastery. Margrethe abdicated on the same day of January that she ascended the throne following the death of her father, King Frederik IX, on Jan. 14, 1972.

Australians also turned out on the streets of Copenhagen to celebrate one of their own becoming queen.

“I think it’s good that she’s not from royalty and has a normal Australian background. We can relate more to that, because she’s from a middle-class background, and we are too,” said Judy Langtree, who made the long journey from Brisbane with her daughter to witness the royal event.

A survey — commissioned by Denmark’s public broadcaster DR — published Friday showed that 79% of the 1,037 people polled by the Epinion polling institute said that they believed Frederik was prepared to take the reigns and 83% said they thought his wife Mary was ready to become queen. The survey margin of error was 3 percentage points, DR said.

Though a hereditary monarchy might seem contradictory to the egalitarian principles of modern-day Denmark, the royal family remains highly popular and the anti-monarchist movement is small.

“The republicans in Denmark have no future,” former parliamentary Speaker Pia Kjærsgaard said on public television.