Henrik Montgomery/Scanpix Sweden, via Associated Press

In what Swedes consider a Cinderella story, Lilian Craig, who died on Sunday at 97, lived for a third of a century as the lover of Sweden’s Prince Bertil, unable to marry because there was a chance he could become king, and Swedish kings were forbidden to wed commoners. Pretty much the whole country knew about their relationship, but they were still barred from appearing in public together.

Three years after King Gustaf VI died, in 1973 — to be succeeded by his grandson Carl Gustaf — Prince Bertil, a son of the older king, finally married Ms. Craig. He was 64 and she was 61, and both called it the happiest day of their lives. Ms. Craig became a princess and duchess with the nuptials.

“I was nervous as a kitten,” Ms. Craig told The Boston Globe in 1985. “I had butterflies in my tummy. When we exchanged vows, I was afraid I wouldn’t even remember my husband’s name.”

The wedding signaled the formal end of an already bygone era. Prince Bertil had agreed to refrain from marrying a commoner because of fears it could jeopardize the royal line: he was next in line to the throne until Carl Gustaf, his nephew — and now the king — came of age. Today, many members of European royalty, including Sweden’s, routinely and without penalty marry commoners, and female prospects have the same succession rights as male. Carl Gustaf himself married a commoner.

Princess Lilian paid a price for her loyalty, including whispers early on about living in sin. She said she regretted not having children. “But now the queen’s children are like my children,” she told The Globe. “It makes up. Well, not quite.”

As for not being allowed to be seen in public for many years, she said: “Sometimes I felt it wasn’t nice. But it was nice that we were together, anyway.”

Her death, in Stockholm, was announced by the royal palace.

Lillian May Davies was born in Swansea, Wales, on Aug. 30, 1915, and left school at 14 to seek work as a maid in London. She ended up working as a fashion model, dancer and singer, and marrying Ivan Craig, an actor. She dropped one of the L’s from her first name, she said, because she thought it seemed more fashionable that way. During World War II, while Mr. Craig served in the British Army in Africa, Ms. Craig worked at a factory making radios for the Royal Navy and at a hospital for wounded soldiers.

There are several versions of how she met Prince Bertil, in 1943, when he was naval attaché in the Swedish Embassy: at a party held to celebrate her 28th birthday, at a nightclub, in the London subway. One story has the prince gallantly rescuing her from a drunken sailor.

In any case, she wrote in her memoir, “My Life With Prince Bertil” (2000), she was captivated: “He was so handsome, my prince. Especially in uniform. So charming and thoughtful. And so funny.”

During their wartime separation, her husband had also developed another romantic tie. They divorced amicably.

Two of Prince Bertil’s brothers had already disqualified themselves from the line of succession by marrying commoners, becoming the first members of the Swedish royal family to do so in 400 years. Their grandfather Gustaf V, who remained king until 1950, had blocked a marriage between Prince Bertil and the daughter of a Swedish Army captain in 1934, according to The Associated Press. Prince Bertil was soon publicly linked to Princess Juliana of the Netherlands, who later became the country’s queen, but that incipient relationship also fell through.

In 1947, Prince Bertil’s eldest brother, Prince Gustaf Adolf, the heir to the throne, died in a plane crash. Gustaf Adolf’s son, Carl Gustaf, was less than a year old, and if the king had died before the child was old enough to assume the throne, Prince Bertil might have had to serve as a regent, or acting monarch.

Both Prince Bertil’s grandfather (who died in 1950) and father refused to allow him to marry a commoner. So he and Ms. Craig lived together in France until 1957, when they moved to Sweden to live discreetly. Her first public appearance with him was in 1972, at the 90th-birthday celebration of King Gustav VI, who had developed a personal liking for her.

Once wed and royal, Princess Lilian, who left no immediate survivors, participated in Nobel Prize events in Stockholm. After Prince Bertil died in 1997, she helped lead sports organizations in which he had been active.

She said laughter was the key to her longevity, and also to her great romance.