He's broadly knowledgeable about the Huntington's archives, a treasure trove of some 9 million objects, and deeply versed in such arcane topics as 19th century British beach culture.

But during an interview late last year in his book-lined office, Ritchie assessed his scholarly attributes more moderately.

"I am not omni-competent across the whole range of the Huntington's interests," Ritchie, 72, said in soft, steady cadences threaded with dry wit. "If you want to do a medieval thing, don't bother coming to me."

Friends and colleagues beg to differ. They suggest that when the tweedy, gentlemanly Scotland native steps down from his post on June 30, the San Marino institution will lose one of its keenest intellects (at least in his administrative role; Ritchie will remain with the Huntington as a senior research associate).

"I've been in academia 40 years, and I have not met three people with Roy's range and skill set," said Steven S. Koblik, the Huntington's president. "He is a truly learned person."

But erudition has been only one of Ritchie's accomplishments since arriving at the Huntington from UC San Diego, where he'd been a professor of early American history and later served as associate chancellor. In many ways, people inside and outside the institution say, Ritchie has helped transform the Huntington from the rather hermetic and stuffy insiders' retreat it was 20 years ago into a far more open and community-involved institution.

By all accounts, during the 1990s Ritchie revitalized the Huntington's research division. Under his leadership, it attracted both established world-class scholars — including a number of Pulitzer Prize winners such as Civil War historian James M. McPherson and 18th century historian Gordon Wood — to serve as senior fellows, as well as promising younger academic specialists. Ritchie also helped secure grants to support them.

Among his achievements in the early 2000s was launching two new research entities with USC: the USC Huntington Early Modern Studies Institute and the Huntington USC Institute on California and the West.

All the while, Ritchie kept exploring his own scholarly interests, notably in Colonial America and the privateers and swashbuckling cutthroats who once prowled the seas. In academic circles he's best known for his 1986 book "Captain Kidd and the War Against the Pirates."

Peter Mancall, a USC professor and director of the joint Early Modern Studies Institute, said that Ritchie had managed the rare feat of merging a scholar's passion with a mentor's generosity.

"Roy didn't lose interest in his research. Roy just kind of found this extra gear," Mancall said. "He has moved into this selfless phase where he has supported other scholars, particularly younger scholars, that has benefitted their careers enormously."

One of Ritchie's jobs is to assess the research value of whatever objects or materials the Huntington's curators wish to acquire. Every year, Ritchie said, this review process is capped by a black-tie dinner "with a lot of wine and good food" prior to holding a vote on the new acquisitions.

"Always it's a giggle, it's a surprise," he said. "I had a bet with somebody last year for a dinner. I was absolutely sure this one thing was going to go first. It went third. Bummer!"

As head of the Huntington's education division, Ritchie also has overseen the exponential growth of the department's professional staff, as well as its army of volunteer docents. He has vastly expanded its range of public programming, such as a triennial Civil War conference that packs the 325-seat Friends' Hall.

Desiree De Bond Vargas, principal of Eagle Rock's Rockdale Elementary School, credits Ritchie and his education staff with developing "an in-depth partnership" with her school that includes teacher training, hands-on student workshops in art appreciation, and even creating a students' picnic area on the Huntington's elegant grounds

"They really did embrace our kids and bring them in as a whole part of the Huntington experience," she said. "It wasn't just, 'Come for this field trip and leave.' "

Physically, Ritchie could pass for a distant cousin of TV pundit Andy Rooney, minus the curmudgeonly streak. His intellectual breadth brings to mind the late U.S. senator, diplomat and Harvard instructor Daniel Patrick Moynihan, but with none of the latter's high-handed mannerisms.

He was born in Dunfermline, Andrew Carnegie's hometown, across the Firth of Forth from Edinburgh. "My dad was a coal miner and my mother was a coal miner's daughter. And they wanted to get out of Dunfermline."

When Ritchie was 9 his family moved to Toronto; they migrated to Southern California when he was 15. After graduating from Bell High School he studied at Occidental College and UCLA, where he earned his doctorate. He joined the UCSD faculty in 1969.

Ritchie hadn't expected to leave San Diego when his future employer first came knocking. "The Huntington had been sort of in a valley for about 20 years, and it had become self-referential, inward-looking, a bit of a man's club essentially," Ritchie said. In those days, he recalled, you could look down the venerable library aisle where researchers sat, known as Mahogany Row, and "the youngest person was 70 years old."

The Huntington's then-president, Robert Skotheim, persuaded Ritchie that major changes were afoot that would open up and professionalize the institution across all departments. When he arrived, Ritchie said, the Huntington mounted exhibitions only from its own permanent collection. Since then, it has hosted critically praised, highly popular shows on Lincoln, Washington and the California Gold Rush.

It also hosts scholars-only symposiums on subjects as varied as Medieval history and modern literary critical theory that attract top professionals. Ritchie's secret to ensuring a good turnout: "Scholars will agree to anything a year ahead of time."

The Huntington expects to name a new research director later this month. Koblik said the search committee has come up with two fundamental notions. "One is Roy is not replaceable." The other, Koblik said, is that Ritchie's successor must build on the "extraordinary base" that he established.

Ritchie plans to spend his next years writing a follow-up to his Captain Kidd book, and another on beach culture, which he said began in British seaside towns that enticed tourists with pseudo-scientific "water" cures. He also may continue to lead Huntington-sponsored high-end cultural tours in Europe and elsewhere.

He leaves behind some unfinished business. He'd still like to see a larger, state-of-the-art auditorium to accommodate the Huntington's ever-increasing activities. But he appears to have no regrets.

"A very good friend of mine said, 'You've given up a professorship in the University of California to go to the Huntington?' Nobody here would be asked that question anymore. 'Why are you at the Huntington?' Because it's a very different place. And there's been a lot of people involved in that."

And few probably more so than a certain omni-competent coal miner's son.