OTTAWA -- A Federal Court judge has ordered the central bureaucracy that serves the prime minister and cabinet to partially release pages of information on four senators at the heart of the 2013 Senate spending scandal, ruling they were improperly withheld.

Justice James O'Reilly ruled parts of the documents -- including a memo Canada's top bureaucrat wrote to then-prime minister Stephen Harper -- were wrongly classified as sensitive legal or ministerial advice, making them exempt from public release under the federal access to information law.

O'Reilly also agreed that portions of the documents related to senators Mike Duffy, Patrick Brazeau, Pamela Wallin and former senator Mac Harb should remain out of public view -- although those details of the written ruling were among large swaths that remained redacted in order to give the government a chance to appeal.

Information commissioner Suzanne Legault said the office is considering whether to appeal any aspects of the decision. The Prime Minister's Office deferred comment to the Privy Council Office.

An expert on the Access to Information Act said the ruling exposes long-standing issues with the decades-old transparency law that may not be fully addressed in the Liberal government's proposed changes to the act.

"It's for the most part a good decision within the constraints of the act, but it is not as if the act is changing and the secrecy the act allows for hasn't changed and doesn't look like it's going to change under the federal Liberals," said Sean Holman, an associate professor of journalism at Calgary's Mount Royal University.

The Liberals have introduced changes to the decades-old transparency law that would let the information watchdog order departments to release documents, but fell short of a lofty campaign promise to make ministers' offices fully subject to the freedom of information regime. It would also allow for departments to refuse requests that are considered frivolous or "vexatious."

The law allows people who pay $5 to ask for everything from internal federal audits and meeting minutes to correspondence and studies, but gives leeway for officials to withhold information for a variety of reasons.

In August 2013, The Canadian Press filed a request to the Privy Council Office, asking for any records created since March about the four senators. Officials refused to release 27 of 28 relevant pages, providing only what O'Reilly described as "innocuous information" like letterhead, signatures, dates and names.

The information commissioner took the PMO to court in late 2015, believing officials "erred in fact and in law" when they declared every word on the 27 pages to be exempt from the Access to Information Act.

O'Reilly found the documents had factual information that should have been released, including decisions Harper made at the time, and that portions considered to be legal advice were nothing of the kind. The judge also rejected government arguments that some of the information contained sensitive personal information -- arguments that appear to have been applied to "discretionary financial benefits."

Further details, again, were deleted from the written ruling.

It was in 2013 that the Senate was plunged into scandal when questions were raised, audits ordered, and criminal investigations launched about the housing expenses incurred by Harb, Duffy and Brazeau, as well as Wallin's travel expenses.

Harb resigned that summer after reimbursing some $231,000 to the public purse, and in November the upper chamber voted to suspend Duffy, Wallin and Brazeau without pay for two years.

Duffy was charged and then cleared last year of 31 criminal charges relating to his Senate expenses, and the RCMP subsequently closed investigations against Wallin and Brazeau.

Duffy is now suing the Senate and the government for more than $7.8 million, claiming his suspension was unconstitutional and a violation of his charter rights, and that the federal government is liable for the RCMP's alleged negligence in its investigation.

The Senate has worked to dig itself out from under the cloud of financial scandal, publicly posting expenses and trying to heed the call of the federal auditor general for greater transparency. There were calls Friday for the upper chamber to have outsiders oversee senators' expenses, rather than having senators sit in judgment of their peers.

"Canadians demand transparency, and an independent body will provide exactly that," Sen. Peter Harder, the Liberal point man in the Senate, wrote in a column for the digital magazine Policy Options.

"The lesson of the past few years is that light kills germs. The Senate has a duty to shine the light on itself in order to regain the confidence and trust of the people and country it serves."