OTTAWA - Federal parties have been granted three more days to broker a deal aimed at averting a parliamentary showdown -- and possible election -- over sensitive Afghan detainee documents.

Just hours from the Tuesday deadline he'd set two weeks ago, Commons Speaker Peter Milliken agreed to an all-party request for an extension until Friday afternoon.

"I'll wait patiently," Milliken told the Commons.

The government and three opposition parties agreed to seek the extension earlier Tuesday after a 90-minute negotiating session.

"We've arrived at a point where we think some additional time is both necessary and appropriate and could be productively used," Liberal House leader Ralph Goodale said.

"It's complex and it's exceedingly important that we get it right, both in defending the public interest and in defending national security and getting the right balance between the two."

Late last month, Milliken gave the parties two weeks to come up with a formula that would allow MPs to scrutinize uncensored documents without risking national security. The papers relate to allegations detainees captured by Canadian troops were tortured by Afghan authorities.

Failure to strike a deal could lead to a contempt motion against the government, which could trigger a court challenge or even an election.

All four parties have agreed that a small special committee -- made up of at least one MP per party, all sworn to secrecy -- should be able to scrutinize all documents unedited.

The remaining stumbling block revolves around the most crucial point: how to resolve any disagreement that may arise over which documents can be publicly disclosed without risking national security.

"The real issue is what happens in the event that the majority of (special committee members) wants to use (a) document to pursue our obligation as parliamentarians to hold the government to account and the government ultimately says, 'Oh no, that's too secret to be able to do that with,"' said NDP defence critic Jack Harris.

"So how do you deal with that? That's a good question."

Harris said the government has not made a final proposal on that issue yet but has floated the idea of allowing a court to settle disputes -- an unacceptable suggestion as far as the NDP is concerned.

Harris said his party is prepared to allow an independent expert to offer advice but is adamant that the final decision on which documents can be disclosed must rest with MPs on the special committee. He suggested a simple majority vote by committee members should be sufficient, with "no veto" for the government.

Going into Tuesday's negotiating session -- only the fourth since Milliken set the two-week deadline -- opposition parties had been suspicious that the government was deliberately dragging its feet.

While they agreed to ask for a three-day extension, they also made it clear they're not inclined to go beyond Friday.

"If there's no agreement on Friday, then we pursue a (contempt)motion in Parliament," said Harris.

If there is no deal by Friday, Bloc Quebecois House leader Pierre Paquette predicted there will be no deal at all.

Goodale would not entirely rule out requesting another extension but he said: "I think we're all of a feeling around the table that we should try to polish this off by Friday."

Goodale said he remains "hopeful" a deal can be reached but he added: "I think confident might be too strong a word."