Daniel H. Weiss, president of Haverford College, is leaving after only two years to head the Metropolitan Museum of Art in New York City, officials announced Tuesday.

His presidential tenure is the shortest in Haverford's 181-year history, though the previous leader, Stephen G. Emerson, wasn't there much longer - four years.

"Although my time at Haverford has been relatively brief, my experience here has been profound," Weiss, 57, said in an e-mail to the Haverford community.

The job will be Weiss' first outside higher education, but the transition will not be so unusual for an art historian with an M.B.A. Weiss, who grew up on Long Island, said in his e-mail that he had held "a lifelong interest in museums."

The Metropolitan is the country's largest art museum. Its president, Emily Kernan Rafferty, will retire March 31 after 10 years in the post.

Haverford, a highly selective liberal arts college on the Main Line, has about 1,200 students and an endowment of about $480 million.

Haverford announced Weiss' hiring in May 2012 and waited more than a year for him to take the helm in July 2013, so he could fulfill his commitment to Lafayette College in Easton, Pa., where he had been president since 2005.

Under Weiss' leadership, Haverford ended its all-grant financial aid policy, saying that was too expensive, and reintroduced loans. The college also faced divisiveness over one of its commencement speakers last spring. After students protested the selection of Robert J. Birgeneau, former chancellor of the University of California Berkeley, one of the other scheduled speakers, William G. Bowen, former president of Princeton, used the occasion to deliver a sharp rebuke to students, calling their approach "immature" and "arrogant."

The college also received its largest gift in its history under Weiss - $25 million from Howard Lutnick, chairman of the board of managers.

Weiss has been a staunch defender of the liberal arts. In 2013, he wrote and coedited a book, Remaking College, with former Swarthmore president Rebecca Chopp, on the role the liberal arts play in educating the world's leaders and problem-solvers.

Lutnick praised Weiss. "Dan leaves Haverford in a position of strength," he said.

Haverford will look to fill the vacancy in the coming months.

Editor's note: This story was revised to reflect that Robert J. Birgeneau, former chancellor of the University of California Berkeley, was to be one of several commencement speakers at Haverford College last spring.