Australia has promised to return documents to East Timor concerning their jointly managed undersea oil and gas fields - but only if they don't pose a threat to national security.

The statement came during the last day of a hearing at the United Nations' highest court in The Hague.

Nikki Canning has the details.

(Click on audio tab above to listen to this item)

East Timor, also known as Timor Leste, took Australia to the International Court of Justice seeking the return of documents relating to a controversial oil and gas treaty between the two countries.

East Timor says the documents were confiscated in a raid by the Australian Security Intelligence Organisation in Canberra in December.

It says they show that Australia spied on East Timor to gain the upper hand in the negotiations.

Sir Michael Wood, representing East Timor, told the judges Australia had no right to take the documents.

"By issuing a warrant for a seizure of documents belonging to Timor-Leste and by seizing and retaining such documents the Australian authorities breached the inviolability of Timor-Leste's state papers and violated the immunity to which Timor-Leste is entitled under international law."

Australia's Solicitor-General, Justin Gleeson, told the court ASIO would return the documents as long as they don't pose any threat to Australia's national security.

"If ASIO (Australian Security Intelligence Organisation) finds there is no significant threat, that is the end of the matter and the documents will be returned to Mr Collaery. If it finds a significant threat, it will provide advice on actions Australia can and should take to mitigate the harm to Australia."

After the hearing, East Timor's lawyer, Sir Elihu Lauterpacht said the documents are unlikely to pose any threat.

"The security people in Australia are concerned that state secrets might be opened up, but I don't think there is anything in this case that's going to do Australia any harm. The harm has already been done by Australia to itself, in having seized the materials."

The case is part of a wider dispute involving spy agencies, bugging claims and potentially huge rewards from developing the Greater Sunrise oil and gas fields between Australia and East Timor.