One of the most expensive paintings ever sold in the UK, Sir Joshua Reynolds' Portrait of Omai, has been saved for the nation.
An anonymous benefactor is giving the Tate £12.5m so the gallery can buy the picture and keep it in the UK.
Portrait of Omai was offered for sale in 2001, but the Tate's offer was rejected at the time.
It eventually sold for £10.3m, the second highest price for a British Portrait of Omaipainting.
The most expensive was Constable's The Lock, which was sold for £10.7m in 1990.
The government placed a temporary bar on Sir Joshua's painting leaving the UK in December because of its historical importance.
The painting, which was first shown at the Royal Academy of Arts in 1776, has been kept in the stores of the auction house Christie's in Vauxhall, south London.

Great voyages
Sir Joshua was the first president of the Royal Academy.
The work, featuring a Polynesian boy brought to Britain in 1774, was made at a time of great voyages of exploration and discovery in Australasia.
Such was the desire to keep the painting in the UK that Sir David Attenborough had been due to spearhead a last-ditch attempt to raise the money.
Sir David, chairman of the Arts Fund's centenary committee of honour, said: "This is an extraordinarily generous offer. For my part, it is not often that I have felt moved to support a public campaign to save a work of art but the portrait of Omai is exceptional.
"Reynolds represents the rare moment when two worlds encounter one another for the first time. The painting is a vivid reminder of the way in which art can bridge cultural divides."
Tate director Sir Nicholas Serota said the donation was one of the "great benefactions in the history of philanthropy".

The portrait of Omai is one of the great icons of eighteenth-century art, a symbol of an age which saw unprecedented advantages in areas of travel, commerce, the natural sciences and philosophical thought. The discovery of Tahiti and Omai's arrival in England was a direct result of scientific and economic advances which led to Cook's famous three voyages, and Omai's depiction by Reynolds, owes much to Rousseau's idea of the Noble Savage. Reynold's portrait was first exhibited at the Royal Academy in 1776 and it is significant that the next exhibition in which it appeared was the great 'European Masters of the Eighteenth Century' exhibition at the Royal Academy in 1954 when it appeared with important works by Frogonard. Watteau, Boucher, Canaletto, Bellotto, Batoni and Guardi as well as by the finest British painters. Professor Waterhouse wrote of the eighteenth century that "it was an age which demanded to have its portrait painted with legitimate pride, and no painter better fitted to bequeath to posterity a truthful but sympathetic series of historical images than Sir Joshua Reynolds has ever lived." The portrait of Omai is not only one of the finest portraits painted by one of the greatest portrait painters, it epitomizes more than any other painting the vision of the eighteenth century.

Sir Joshua was given the opportunity to paint Omai because he was such a celebrated artist, and kept the picture at his London gallery.
After his death it was bought by Frederick, the 5th Earl of Carlisle, a patron and close friend of Sir Joshua.
The painting was installed at Castle Howard, a stately home near York, in 1776, where it remained until 2001.

A copy of the painting, as used in the BBC production, now hangs in the Inner Hall of Hinchingbrooke House.