Mary Stewart, the British author of romantic thrillers who jumped genres in her 50s to create an internationally best-selling trilogy of Merlin books, reimagining the Arthurian legend from a sorcerer’s point of view, died on May 9 at her home in the village of Loch Awe, on the west coast of Scotland. She was 97.

Her death was announced by her British publisher, Hodder & Stoughton.

When “The Crystal Cave,” the first book of the trilogy, was published in 1970, Ms. Stewart already had a dozen or so novels to her credit — among them “Nine Coaches Waiting” (1958), “The Moon-Spinners” (1962) and “The Gabriel Hounds” (1967) — and was known for bringing an unexpected intelligence and historical resonance to what some dismissed as frivolous women’s fiction.

Reading Geoffrey of Monmouth’s “History of the Kings of Britain,” she was inspired to retell the story of King Arthur as seen by Merlin, the king’s adviser and house magician. The trilogy introduced her work to a new generation and, in many cases, to male readers for the first time.

In “The Crystal Cave,” Merlin is tutored in the sorcerer’s arts and moves Stonehenge from Ireland to Salisbury Plain. “The Hollow Hills” (1973) follows Arthur’s growth from afar while Merlin seeks the great sword that can bring Arthur to the throne. In “The Last Enchantment” (1979), Arthur is faced with sinister powers and plots while Merlin grows old, weak and mad. The books, set in the fifth century, were praised for their unusual blend of fantasy and historical detail.