Over the past two years, the U.S. government has tried to rein in how major tech companies use the personal data they've gathered on their customers. At the same time, government agencies are themselves seeking to harness those troves of data.

Why it matters: Tech platforms use personal information to target ads, whereas the government can use it to prevent and solve crimes, deliver benefits to citizens — or (illegally) target political dissent.

Driving the news: A new report from the Wall Street Journal details the ways in which family DNA testing sites like FamilyTreeDNA are pressured by the FBI to hand over customer data to help solve criminal cases using DNA.

The trend has privacy experts worried about the potential implications of the government having access to large pools of genetic data, even though many people whose data is included never agreed to its use for that purpose.

The FBI has particular interest in data from genetic and social media sites, because it could help solve crimes and protect the public.

For example, the FBI is "soliciting proposals from outside vendors for a contract to pull vast quantities of public data" from Facebook, Twitter Inc. and other social media companies,“ the Wall Street Journal reports.

The request is meant to help the agency surveil social behavior to "mitigate multifaceted threats, while ensuring all privacy and civil liberties compliance requirements are met."

Meanwhile, the Trump administration has also urged social media platforms to cooperate with the government in efforts to flag individual users as potential mass shooters.

Other agencies have their eyes on big data troves as well.

Earlier this year, settlement talks between Facebook and the Department of Housing and Urban Development broke down over an advertising discrimination lawsuit when, according to a Facebook spokesperson, HUD "insisted on access to sensitive information — like user data — without adequate safeguards."

HUD presumably wanted access to the data to ensure advertising discrimination wasn't occurring on the platform, but it's unclear whether the agency needed user data to be able to support that investigation.

Investigations of specific crimes are the most common situations that pit the government's law enforcement needs against tech companies' privacy rules.

Two years ago, the government and Apple fought to a standstill over encryption following the San Bernardino shooting.

Apple denied the FBI's request to help investigators gain access to the shooter's cellphone. Apple took the battle to court, but the conflict fizzled after the FBI figured out a way to access the phone on its own.

Experience demonstrates that gathering stockpiles of data holds a magnetic attraction for government.

In the post 9/11 era, the National Security Agency began a long and controversial program, widely seen as extra-legal, to broadly monitor phone and other telecommunications messages.

Be smart: History shows that when governments acquire vast stocks of personal data on their citizens, it's very tempting for them to use that information for political purposes or personal vendettas.

The big picture: Privacy experts fear that we're going to keep making mistakes and improvising through crises since we haven't had a broad debate over setting boundaries around government access to personal data collected by tech companies.

Editor's note: This story has been corrected to accurately characterize the details of Apple's dispute with the FBI over the San Bernardino shooter's phone.