One of the most valuable paintings in Wales has been sold for £8.1m and is going back to the artist's native Holland.
The castle had tried to find a home in the UK for the painting
The Burgomaster of Delft, by artist Jan Steen, which dates from around 1655, has been owned by the Douglas-Pennant family, of Penrhyn Castle in Gwynedd, since the middle of the 19th Century.
The painting will be moved to the Rijksmuseum in Amsterdam once a permanent export licence is obtained.
The museum said in a statement that it was the most expensive painting it had ever bought.
Stephen Somerville, who negotiated the sale for the Douglas-Pennant family, said the National Trust, which owns Penrhyn Castle, was given the opportunity to buy the painting, as was the National Museums and Galleries of Wales - but neither could raise the money.
Although the painting was leaving Wales, other artefacts from the Douglas-Pennant family collection had been handed to National Trust ownership for the public to view at the castle.
"It would have been very nice if it could have stayed in Penrhyn," said Mr Somerville.
"But the National Trust were unable to find the money to purchase it, given that they have other priorities.
"Everything was done over the last two year to allow institutions in Wales to come up with a campaign to keep the painting.
"However, while the painting is leaving Penrhyn, the family has recently allowed numerous items, including works by Gainsborough, Canaletto and furniture by Thomas Hopper to pass into the nation's ownership and go on display for the public.
"The family wants to keep Penrhyn Castle looking its best for visitors.
"One item may have gone out, but many others have come in."
He added that if the painting could not stay in Wales, at least it could be said to be going home to the Netherlands.
"Ultimately, if it can't stay in the UK, or go to Delft, Amsterdam is the best place for the painting," Mr Somerville said.
A National Trust spokeswoman said: "We are grateful to the family for letting us display the painting for so long.
"But we were unable to meet the purchase price because of the demands of our other responsibilities."
The painting is one of the few portraits done by Jan Steen and is characterised by what the museum describes as a "sparkling palette and lucid composition that brings to mind the works of later Delft artists of the 17th century such as Johannes Vermeer and Pieter de Hooch."
It features the combination of portrait and cityscape, a genre that was just beginning to develop as a separate subject in Delft.
The painting shows a burgher portrayed as a benefactor on the steps of his house on the Oude Delft canal.
He seems to be considering his charitable deeds in front of a poor old woman and the orphan at her side who are appealing to him.
The identity of the man is not known.
The tower of the Old Church in Delft is in the distance.
Steen worked in various towns including Leiden, The Hague, Delft, Warmond, and Haarlem.
In 1672 he opened a tavern in Leiden and many of his pictures represent taverns and festive gatherings.