On his first day in office in 2009, President Barack Obama promised his administration would usher in a new era of transparency and openness in government. But both of the final two years of his presidency set records for the amount of times the government denied public records requests under the Freedom of Information Act (FOIA). And those denials weren't cheap: The administration spent $36.2 million on legal feeds defending its refusals in court in 2016, another record. 

Under the Freedom of Information Act, the government must provide records to any person that requests them for little or no cost, provided those records aren't covered by a variety of exceptions written into the law, which cover sensitive materials such as state secrets and ongoing investigations. Last year, people received nothing  or censored files in response to 77 percent of requests, an Associated Press analysis said Tuesday, which represents a 12 percent over Obama's first year in office. 

Read: WikiLeaks: Obama's CIA Hacked Phones And TVs And Turned Them Into Spy Devices

Even the government acknowledged it should have been more forthcoming with records. In 2016, the government admitted it incorrectly refused to turn over all or parts of records in more than one-third of denied cases, the AP said in its Tuesday report. 

The increased rate of denials could be tied to an increased volume of requests. Last year, the federal government spent $478 million responding to a record 788,769 requests across more than 100 federal departments and agencies. But many of those agencies spent millions fighting the records requests in court. The Justice Department led the way, spending $12 million on those legal battles, followed by the Department of Homeland Security, which spent $6.3 million, and the Pentagon, which produced $4.8 million in legal fees. 

In spite of the records set in 2015 and 2016, the Obama administration did enact some transparency measures. It rescinded the George W. Bush administration's pro-secrecy changes to the Presidential Records Act, introduced the Open Government Directive, and implemented measures to push agencies to publish data and enact public feedback systems, the Washington Post noted in 2015

But the Obama administration also waged an unprecedented war on people who disclosed secret government information. The Obama administration used the 1917 Espionage Act to bring prosecutions against leakers (a group that is often described as "whistleblowers" by supporters) at a rate more than double all previous presidents combined.

Obama did, however, commute the sentence of famous leaker Chelsea Manning in the final days of his presidency. 

Read: Edward Snowden Not Pardoned By Obama: Why Chelsea Manning Got Clemency But Not NSA Whistleblower