A large oil sketch by Flemish master Rubens is being kept in Britain following a £5.7m fundraising drive.
The Apotheosis of James I will now go on permanent display at Tate Britain after funds were secured to meet the asking price at the 11th hour.
The masterpiece was commissioned by Charles I for the ceiling of the Banqueting House in Whitehall, London.
Tate Britain began its appeal to save the sketch, which has been in a private collection for 200 years, in March.
Dating from 1629-30, the work was valued at £11.5m but was offered to the Tate for £6m which it had to raise by 31 July to prevent the sketch from being sold abroad.
"I am simply thrilled that the Rubens sketch has been saved for the nation and that it will now hang on permanent display at Tate Britain," Tate Britain director Stephen Deuchar said.
"This is the first Rubens work to enter Tate's collection and is a unique treasure in the history of British art.
TV historian David Starkey, who backed the campaign, said: "This work is of the utmost significance to British history.
"The Banqueting House with its stunning Rubens ceiling is all that remains of the original Whitehall Palace after it was destroyed by fire in 1698.
"The loss of the sketch would have been a fundamental betrayal of our national heritage and I am delighted that it will remain on public display in London," he added.
The National Heritage Memorial Fund granted a further £221,000 at the last minute on top of its £2m pledge to meet the asking price.
Charity The Art Fund also pledged another £100,000 on top of its initial £500,000 grant.
Tate members contributed £1.5m and money also came from Tate Trustees, who committed £1m of Tate funds, as well as individuals, trusts and around £10,000 from collection boxes.
Rubens was one of the most celebrated artists of his time, and the sketch was commissioned around 1628 while he was visiting Britain as an ambassador for King Philip IV of Spain.
The work was Rubens' first sketch for seven of the nine eventual component panels of the Whitehall ceiling.