WASHINGTON -- The federal government censored, withheld or said it couldn't find records sought by citizens, journalists and others more often last year than at any point in the past decade, according to an Associated Press analysis of new data. The calculations cover eight months under President Trump -- the first hints about how his administration complies with the Freedom of Information Act (FOIA).

The surge of people who sought records but ended up empty-handed was driven by the government saying more than ever it could not find a single page of requested files and asserting in other cases that it would be illegal under U.S. laws to release the information.

People who asked for records under the Freedom of Information Act received censored files or nothing in 78 percent of 823,222 requests, a record over the past decade. When it provided no records, the government said it could find no information related to the request in a little over half those cases.

Get Breaking News Delivered to Your Inbox

It turned over everything requested in roughly one of every five FOIA requests, according to the AP analysis.

Records requests can take months -- even years -- to get fulfilled. Even then, the government censored documents in nearly two-thirds of cases when it turned over anything.

The federal government also spent $40.6 million last year in legal fees defending its decisions to withhold federal files, also a record. That included the time when a U.S. judge ruled against the AP and other news organizations asking for details about who and how much the FBI paid to unlock the iPhone used by a gunman in a mass shooting in San Bernardino, California. When the government loses in court, it sometimes must pay the winner's attorney's fees. For example, the New York Times was awarded $51,910 from the CIA in May in a fight over records about chemical weapons in Iraq.

It was impossible, based on the government's own accounting, to determine whether researchers, journalists and others asked for records that did not actually exist or whether federal employees did not search hard enough before giving up. The government said it found nothing 180,924 times -- an 18 percent increase over the previous year.

"Federal agencies are failing to take advantage of modern technology to store, locate and produce records in response to FOIA requests, and the public is losing out as a result," said Adam A. Marshall, the Knight Foundation litigation attorney at the Washington-based Reporters Committee for Freedom of the Press.

He said citizens and others should try to precisely describe how they want filings cabinets, hard drives or email accounts searched, but "you shouldn't have to be an expert in records management just to submit a FOIA."

In other cases, the times the government said it would be illegal under other U.S. laws to release requested information nearly doubled to 63,749. Those laws include broad prohibitions against revealing details about U.S. intelligence activities or foreign governments, trade secrets, individual banking or tax records and more.

Many of those requests probably involved files related to the U.S. investigation into how Russia interfered in the 2016 presidential election or the related grand jury investigations or about Trump's personal or business tax returns, said Kel McClanahan, a Washington lawyer who frequently sues the U.S. government for records. "How many people do you think asked for Trump's tax returns?" he asked.

A disturbing trend continued: In more than one-in-three cases, the government reversed itself when challenged and acknowledged that it had improperly tried to withhold pages. But people filed such appeals only 14,713 times, or about 4.3 percent of cases in which the government said it found records but held back some or all of the material.

The Trump administration, in a new report last week, noted that it received a record number of information requests last year. It said many agencies reduced their backlogs of overdue requests.

The administration also said it was directing federal agencies to improve the number of requests they process and do some more quickly.

Performance under the records law by the Trump administration has been a source of curiosity, since Mr. Trump has eschewed some of the common conventions of transparency. For example, the president has declined to release his personal tax returns or logs of official visitors to the White House, and ethics waivers granted to many of Mr. Trump's political appointees do not include details about their former or current corporate clients.

But Mr. Trump is personally more accessible to reporters asking questions than President Barack Obama, and he released as many details about his medical records as previous presidents.

The Freedom of Information Act figures, released Friday, cover the actions of 116 departments and agencies during the fiscal 2017, which ended Sept. 30. The highest number of requests went to the departments of Homeland Security, Justice, Defense, Health and Human Services, and Agriculture, along with the National Archives and Records Administration and Veterans Administration.

The administration released its figures ahead of Sunshine Week, when news organizations promote open government and freedom of information.

Under the records law, citizens and foreigners can compel the U.S. government to turn over copies of federal records for no or little cost. Anyone who seeks information through the law is generally supposed to get it unless disclosure would hurt national security, violate personal privacy, or expose business secrets or confidential decision-making in certain areas.