A portrait of Charles Dickens that was lost for more than 130 years is “coming home” after a successful fundraising campaign.

The Charles Dickens Museum at 48 Doughty Street in London said the target of raising £180,000 had been reached to buy the painting by Margaret Gillies of the writer when he was 31, theguardian.com reported.

It was once a famous image, displayed at the 1844 Royal Academy summer exhibition. But Gillies said in 1886 that she had “lost sight of the portrait.”

It remained lost until, covered in mold, it was improbably spotted in a cardboard box of trinkets at an auction in South Africa.

The museum said it had received substantial grants from the Art Fund and the lottery-funded Arts Council England/V&A Purchase Grant Fund, as well as donations from admirers of Dickens.

Cindy Sughrue, the director of the museum, said, “We are so excited to be bringing the lost portrait home and we are extremely grateful, and touched by, the generous support that we have received. It is a magnificent affirmation of the enduring appeal of Dickens’s writing and the worldwide fascination that he continues to inspire.

Dickens was already an emerging literary star when Gillies painted him and would have been in the thick of writing ‘A Christmas Carol.’ The poet Elizabeth Barrett Browning saw the portrait and remarked how it “has the dust and mud of humanity about him, notwithstanding those eagle eyes.”

It reemerged when someone paid the equivalent of £27 for a tray of stuff at auction in in Pietermaritzburg, which also included a metal lobster, an old recorder and a brass plate.

After some online research, the buyer realized the painting had the look of Dickens and contacted the art dealer Philip Mould.

Mould said its reemergence was astonishing. “It is an epic tale with a supremely happy ending,” he said.

The Gillies portrait will go on display from October 24 and be a regular part of the program although, to help its preservation, there will be times when it is not on display, the museum said.