A "hellish" week of hard-fought negotiations sealed a deal to financially compensate members of the military and other federal agencies who were investigated and sanctioned because of their sexual orientation, says the lawyer representing them.

The agreement in principle with the government to provide reparations for decades of discrimination is a "fair and reasonable settlement" for the lead plaintiffs and thousands of people who stand to benefit as part of the class-action suit, counsel Doug Elliott said Sunday in an interview.

"It's not perfect, of course, but any settlement is a compromise," Elliott said. "And one of the things that we were obviously concerned about in this case is that we know some of our class members are in poor health. Some of them are quite elderly, and some of them are living in desperate poverty."

The Federal Court action that paved the way for the deal involved federal employees who were "investigated, discharged, terminated, sanctioned or faced threat of sanction" by the government after June 27, 1969 — when homosexual acts were decriminalized — because of their sexual orientation, gender identity or gender expression.

The Liberal government's plan to deliver a formal apology this Tuesday for wrongs perpetrated on the LGBTQ community put a lot of pressure on both sides to settle the lawsuit, Elliott said.

"I thought we were going to go off the cliff earlier this week."

Elliott got the impression someone in the federal government thought his clients would be "willing to take anything" because the apology had been scheduled and might not happen without resolution of the lawsuit.

"Personally, I was prepared to walk away from the apology if they were going to give us a bad deal," he said. "That didn't happen, thankfully."

Elliott declined to discuss details of the settlement until a news conference following the apology on Tuesday.

The two sides will soon sit down to flesh out the framework agreement.

"There's a lot of details that are missing because we just didn't have time to work them out," he said. "And we're satisfied that we have an understanding on both sides of what the framework means, that we will be able to come up with language that will spell out the details in coming weeks."

The Federal Court will then examine the settlement to determine whether it considers the deal to be fair. This will be accompanied by a notice program, to be approved by the court, to all of those who might join the class action.

"That will give them an opportunity to know what's involved and make a decision about whether they want to participate in the settlement or whether want to opt out," Elliott said.

"Personally, I would like to see this wrapped up before Pride season next year, which gets started in June. For lawyers, that's a pretty ambitious time-frame."

It is anticipated that the overall scope of the government apology, to be delivered by Prime Minister Justin Trudeau, will surpass what other countries have done to make amends to LGBTQ communities.

Trudeau's announcement on Tuesday is expected to include a commitment to help paint a fuller picture of what many have come to call the gay purge. While some records about federal policies have trickled out over the years, many documents remain shrouded in official secrecy.

Several other cabinet members will be involved, including Defence Minister Harjit Sajjan, Veterans Affairs Minister Seamus O'Regan, Public Safety Minister Ralph Goodale, Treasury Board President Scott Brison and Canadian Heritage Minister Melanie Joly.

Joly is expected to outline additional steps the government will take in coming weeks to publicly recognize the historical wrongs.

The government is also set to introduce legislation to expunge the criminal records of people convicted of consensual sexual activity with same-sex partners, whether in civilian or military courts.

The move follows similar efforts by governments in Australia, Germany and New Zealand.

Elliott said he's pleased Canada is moving to wipe out the criminal records rather than issue criminal pardons.

"A pardon is when the Queen forgives you for doing something wrong," he said. "I think was a situation where the Queen should be asking for our forgiveness for having wronged our community."