SYDNEY (Reuters) - Australia’s domestic spy agency on Thursday took possession of thousands of classified documents that were left at a second-hand furniture shop as the government struggles to contain an embarrassing security lapse.

FILE PHOTO - Former Australian Prime Minister and ASPI President Kevin Rudd gives a speech during the 2017 Asia Game Changer Awards and Gala Dinner in Manhattan, New York, U.S. November 1, 2017. REUTERS/Amr Alfiky

The documents, which revealed top-secret details of five previous governments that under Australian law should remain secured for at least 20 years, were left inside a filing cabinet that was then sold at a store in Canberra that was stocked with ex-government furniture.

The documents were then passed onto the Australian Broadcasting Corporation (ABC) that ran a string of stories, embarrassing former prime ministers and several lawmakers who still occupy prominent positions inside Australia’s centre-right government.

The ABC said the Australian Security and Intelligence Organisation took the files after talks with the spy agency in recent days, though as part of negotiations the national broadcaster said it will still have access to the files.

The documents showed: Australia’s now treasurer Scott Morrison sought to slow down security checks on refugees in order to restrict their chances of resettlement; former Prime Minister Tony Abbott considered abolishing financial aid to unemployed young Australians; the country’s police lost hundreds of sensitive files.

Australia’s Deputy Prime Minister Barnaby Joyce said there had been a serious breach of security.

“Obviously someone’s had a shocker and the investigation will find out exactly how this happened,” Joyce told ABC radio on Thursday.

“In the process of running a country, there are things which go awry. This is one of them.”

Seeking to minimise the fallout of the security lapse, prominent conservative lawmakers have sought to focus attention on the decision of the ABC to publish details found within the top secret files.

The ABC defended the publication, insisting it was in the national interest, though former Prime Minister Kevin Rudd said on Twitter on Thursday that he had launched legal action against the national broadcaster.

Rudd was this week left embarrassed after the ABC ran a story that said the former leader had ignored advice around the dangers of a home insulation package in 2008.

Rudd was later cleared on any wrongdoing by an independent investigation with sweeping powers, which he said the ABC ignored in its reporting.

“The report by the ABC alleging I ignored warnings on the risks to the safety of installers of home insulation is a lie,” Rudd said in the statement.