LONDON (AP) — Queen Elizabeth II, Britain’s longest-reigning monarch and a symbol of stability in a turbulent era that saw the decline of the British empire and embarrassing dysfunction in her own family, died Thursday after 70 years on the throne. She was 96.

Buckingham Palace said she died at Balmoral Castle, her summer residence in Scotland, where members of the royal family had rushed to her side after her health took a turn for the worse.

A link to the almost-vanished generation that fought World War II, she was the only monarch most Britons have ever known.

Her 73-year-old son Prince Charles automatically became king and will be known as King Charles III, his office said. Charles’ second wife, Camilla, will be known as the Queen Consort.

The BBC played the national anthem, “God Save the Queen,” over a portrait of her in full regalia as her death was announced, and the flag over Buckingham Palace was lowered to half-staff as the second Elizabethan age came to a close.

The impact of her loss will be huge and unpredictable, both for the nation and for the monarchy, an institution she helped stabilize and modernize across decades of enormous social change and family scandals, but whose relevance in the 21st century has often been called into question.

The changing of the guard also comes at a fraught moment for Britain, which has a new prime minister and is grappling with an energy crisis, double-digit inflation, the war in Ukraine and the fallout from Brexit.

Charles, who is nowhere near as popular as his mother, called her death “a moment of the greatest sadness for me and all members of my family.”

“I know her loss will be deeply felt throughout the country, the Realms and the Commonwealth, and by countless people around the world,” he added.

British Prime Minister Liz Truss, appointed by the queen just 48 hours earlier, pronounced the country “devastated” and called Elizabeth “the rock on which modern Britain was built.”

Crowds gathered outside Buckingham Palace in the rain and some people wept when officials carried a notice confirming the queen’s death to the gates of her London home.

In Canada, where the British monarch is the country’s head of state, Prime Minister Justin Trudeau saluted her “wisdom, compassion and warmth.” In India, Prime Minister Narendra Modi tweeted: “She provided inspiring leadership to her nation and people. She personified dignity and decency in public life. Pained by her demise.”

President Joe Biden called her a “stateswoman of unmatched dignity and constancy who deepened the bedrock alliance between the United Kingdom and the United States.”

Since Feb. 6, 1952, Elizabeth reigned over a Britain that rebuilt from a ruinous war and lost its empire; joined the European Union and then left it; and made the painful transition into the 21st century. She endured through 15 prime ministers, from Winston Churchill to Truss — a fixed point and a reassuring presence even for those who ignored or loathed the monarchy.

She became less visible in her final years as age and frailty curtailed public appearances, and she used a cane after the April 2021 death of Philip, her husband of 73 years. She was hospitalized for a night for tests later that year.

But she remained firmly in control of the monarchy and at the center of national life as Britain celebrated her Platinum Jubilee in June. That same month, she became the second-longest-reigning monarch in history, behind 17th century French King Louis XIV, who took the throne at age 4.

In 1947, almost five years before becoming queen, the 21-year-old Elizabeth promised the people of Britain and the Commonwealth that “my whole life, whether it be long or short, shall be devoted to your service.”

It was a promise she kept across more than seven decades.

Elizabeth Alexandra Mary Windsor was born in London on April 21, 1926, the first child of the Duke and Duchess of York. She was not born to be queen — her father’s elder brother, Prince Edward, was destined for the crown, to be followed by any children he had.

But in 1936, when she was 10, Edward VIII abdicated to marry twice-divorced American Wallis Simpson, and Elizabeth’s father became King George VI.

Princess Margaret recalled asking her sister whether this meant that Elizabeth would one day be queen. ”‘Yes, I suppose it does,’” Margaret quoted her as saying. “She didn’t mention it again.”

Elizabeth was barely in her teens when Britain went to war with Germany in 1939. Elizabeth and Margaret lived mostly at Windsor Castle, spending many nights in an underground bomb shelter. Eager to help the war effort, the heir to the throne joined the Auxiliary Territorial Service in 1945, learning to drive and service heavy vehicles.

On the night the war ended in Europe, May 8, 1945, she and Margaret mingled, unrecognized, with celebrating crowds in London. She later called it “one of the most memorable nights of my life.”

At Westminster Abbey in 1947 she married Royal Navy officer Philip Mountbatten, a prince of Greece and Denmark whom she had first met in 1939 when she was 13 and he 18.

Their first child, Prince Charles, was born on Nov. 14, 1948. He was followed by Princess Anne in 1950, Prince Andrew in 1960, and Prince Edward in 1964. Besides those children, she is survived by eight grandchildren and 12 great-grandchildren.

In February 1952, George VI died after years of ill health at age 56. Elizabeth, visiting Kenya, was told she was now queen.

“In a way I didn’t have an apprenticeship,” Elizabeth told the BBC in 1992. “My father died much too young, and so it was all a very sudden kind of taking on, and making the best job you can.”

Her coronation came over a year later at Westminster Abbey, a spectacle seen by millions through the new medium of television.

Prime Minister Winston Churchill’s first reaction was that the new queen was “only a child,” but he was won over within days and became an ardent admirer.

She held weekly private meetings with her prime ministers, and they generally found her well-informed, inquisitive and up to date.

Her views in those meetings became a subject of speculation and fertile ground for dramatists like Peter Morgan, author of the play “The Audience” and hit TV series “The Crown.” Those semi-fictionalized accounts were the product of an era of declining deference and rising celebrity, when the royal family’s troubles became public property.

Early in her reign, Princess Margaret provoked a national controversy through her romance with a divorced man. In 1992, during what the queen called the “annus horribilis,” Princess Anne was divorced, Prince Charles and Princess Diana separated, and so did Prince Andrew and his wife, Sarah. That was also the year Windsor Castle was seriously damaged by fire.

The public split of Charles and Diana was followed by the shock of her death in a Paris car crash in 1997. For once, the queen appeared out of step amid unprecedented public mourning, failing to make a public show of grief that was seen by many as unfeeling. After several days, she made a televised address to the nation.

The dent in her popularity was brief. She was by now a sort of national grandmother, with a stern gaze and a kind smile.

She was arguably the most famous person in the world. But her inner life and opinions remained mostly an enigma. The public saw only glimpses of her personality — her joy watching horse races at Royal Ascot, or her pleasure in the companionship of her beloved Welsh corgi dogs.

In 2015, she overtook her great-great-grandmother Queen Victoria’s reign of 63 years, seven months and two days to become the longest serving monarch in British history, and she kept working into her 10th decade. The loss of Philip at age 99 in 2021 was a heavy blow.

And the family troubles kept coming. Her son, Prince Andrew, was entangled in the sordid tale of sex offender Jeffrey Epstein, an American businessman who had been a friend. The queen’s grandson Prince Harry walked away from Britain and royal duties after marrying American actress Meghan Markle in 2018.

As the queen entered her mid-90s, she had what the palace called “mobility issues.” In May, she asked Charles to stand in for her at the State Opening of Parliament, one of the monarch’s key constitutional duties.

On Sept. 6, she presided at a ceremony at Balmoral Castle to accept the resignation of Boris Johnson as prime minister and appoint Truss as his successor.

As Britons endured loss, isolation and uncertainty during the coronavirus pandemic, she made a rare video address in 2020 that urged people to stick together, summoning the spirit of World War II and echoing Vera Lynn’s wartime anthem, “We’ll Meet Again.”

“We should take comfort that while we may have more still to endure, better days will return. We will be with our friends again. We will be with our families again. We will meet again,” she said.

__

Associated Press writers Gregory Katz and Robert Barr contributed material before their deaths.

—-

Follow AP coverage of Queen Elizabeth II at https://apnews.com/hub/queen-elizabeth-ii