The Walters Art Museum, a Baltimore institution filled with the work of European masters, medieval art and manuscripts and Asian art, announced yesterday that it has purchased a nearby building that will allow it to expand.

The museum said it has received an anonymous gift of $1.5 million to purchase a three-story building from the Maryland Historical Society. The property is just west of the art museum and serves as a home for the Contemporary Museum, offices of the Maryland Humanities Council and storage areas for the historical society.

"In 2003 and 2004 we did a long-term analysis of our needs and one of the core pieces was the exploration of expansion. It ranked so high because there is an increasing urgent need for space for exhibitions and public activities," said Gary Vikan, the museum's director.

The Walters, which opened in 1934, now fills three buildings and in recent years has been active on the renovation and refurbishing front. In 2001 it completed a $24 million renovation of its main building; last fall it finished remodeling its smaller signature palazzo-like building. "We had just reopened the original Walters building and in the last four years had installed 4,000 works. And then before we had a chance to put our feet up, this opportunity happened. And when you have the momentum, you have to go ahead," Vikan said.

The historical society last year completed a $30 million expansion of its buildings, which are across the street from the property being sold to the Walters. The renovation generated additional space, making the sale possible.

The building was constructed in 1928 as the headquarters for an insurance company. The money from the pending sale will be used for conservation and study facilities for scholars, authors and students. "This is certainly a win-win-win situation," said the society board's president, Henry Stansbury.

The Walters is hiring architects and planners to look at the space -- 36,000 square feet.

Besides additional exhibition space, Vikan said, the museum needs space for storage, staff, new collections and large traveling shows.

"When we had the Egyptian art show from the British Museum, it covered two floors and we had to vacate some of our permanent galleries. We need space for temporary shows without having to deconstruct our galleries," he said.

The museum hopes to close on the purchase by the end of the year. That will make the Walters the landlord of the Contemporary Museum, a grass-roots museum founded in 1989 that does site-specific exhibitions and shows in its gallery space. It has done two shows with the Walters and is planning one on contemporary artist Louise Bourgeois.