Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

There was a time when President Donald Trump seemed to like government leaks.

When he campaigned for office he once gushed that he “loves WikiLeaks.” He also invited Russia to find Democratic presidential rival Hillary Clinton's missing State Department-related emails.

The tide has certainly turned. President Trump now fumes about the frequent and “un-American” leaks pouring out of his administration —most notably those that helped lead to the abrupt exit of former national security adviser Michael Flynn.

National Security Adviser Michael Flynn waits before the start of a White House news conference with President Trump and Prime Minister Shinzo Abe of Japan on Feb. 10. Ron Sachs / Zuma Press

But while government leaks have plagued Trump's administration early on, they've long been a fixture in American politics and, in some cases, have been the impetus of positive change, history and legal experts say.

"We have a very long history of leaks in this country, it's almost a long-standing tradition," said Mary-Rose Papandrea, a professor at the University of North Carolina School of Law.

Related: Trump Defends Mike Flynn, Blasts ‘Fake News’ and Leaks

And, while there are a number of statutes, from the Espionage Act to the Intelligence Identities Protection Act, that criminalize leaks, “there is still not a catch-all one size fits all law that makes leaking illegal,” said Heidi Kitrosser, a professor at the University of Minnesota Law School.

Related: Two House Chairmen Ask for Justice Department Probe Over Flynn ‘Leaks’

Here's a short history of some of the nation's most notable leaks:

The Hutchinson Letters

Founding father Benjamin Franklin found himself embroiled in a leak when he passed letters to revolutionaries written by Governor of Massachusetts Thomas Hutchinson, asking for stronger British presence in Boston. The letters were published by the Boston Gazette in 1773 erupting one of the biggest scandals of the time.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

A caricature of Thomas Hutchinson (1711-1780) to the right with a devil and skeleton to his left appeared in The Massachusetts calendar; or An almanack for the year of our Lord Christ 1774. American Antiquarian Society

Leaked Treaty of Guadalupe Hidalgo

In 1848, journalist John Nugent published an unsigned copy of the Treaty of Guadalupe Hidalgo,which would put an end to the Mexican-American War. An infuriated Congress held Nugent in the Capital Building for an entire month in an effort to attain the identity of the leaker, which Nugent never gave up.

Related: Former CIA Director Panetta: Building Loyalty With Intel Can Help Stop Leaks

Pentagon Papers

New York Times journalist Daniel Ellsberg was handed a hefty leak in the form of the “Pentagon Papers,” which revealed unsavory details about the Department of Defense and the Vietnam War in 1971.

“The Pentagon Papers had a big impact on the Vietnam War because it exposed what the government was doing as opposed to what the government said it was doing,” said Mary-Rose Papandrea, a professor at University of North Carolina School of Law.

Daniel Ellsberg, co-defendant in the Pentagon Papers case, talks to media outside the Federal Building in Los Angeles in April 28, 1973. Wally Fong / AP, File

Embarrassed and exposed, the government sued the press over the leaks, with the lawsuit going all the way to the Supreme Court, which sided with the first amendment noting that a “free and unrestrained press” would “prevent any part of the government from deceiving the people.”

Watergate

In the Watergate scandal, a source known as “deep throat,” (later revealed to be FBI Associate Director Mark Felt) leaked information to two Washington Post journalists, Carl Bernstein and Bob Woodward, about illegal activities allegedly conducted under President Nixon.

Related: U.S. Has ID’d Russians Who Gave Hacked Emails to WikiLeaks

The revelation not only ended Nixon’s presidential career but put into motion a series of ethical checks and balances, said Hana Callaghan, director of the Government Ethics Program at Santa Clara University.

“A lot of the ethics laws that govern the different agencies and branches of the federal government came about as a result of Watergate,” she said. “The Office of Government Ethics was created after that,” she said.

President Richard M. Nixon is shown pointing to the transcripts of the White House tapes in this April 29, 1974, file photo, after he announced during a nationally-televised speech that he would turn over the transcripts to House impeachment investigators. ASSOCIATED PRESS

Post 9/11 Leaks

Following the attacks on September 11, the government instituted a variety of surveillance and interrogation methods that were completely unbeknownst to the public until leaks.

Waterboarding, CIA black sites, and practices at Abu Ghraib prison were all unmasked through a series of leaks, said Rahul Sagar, a politics professor at New York University and author of Secrets and Leaks: The Dilemma of State Secrecy.

“Pubic conversations that caused a reexamination of these controversial methods can be traced back to leaks,” he said. “Many of the leaks led to changes in the way the ‘war on terror’ was conducted by setting some ground rules,” he said.

NSA Leaks

Former National Security Agency contractor Edward Snowden fled to Russia after exposing the government’s mass data collection via journalist Glenn Greenwald in 2013.

In this handout photo provided by The Guardian, Edward Snowden speaks during an interview in Hong Kong. The Guardian / Getty Images, Handout

The data dump sparked outrage among civil rights groups and privacy advocates who were stunned to find out the extent to which the public was surveilled without any legal process.

“Whatever side you fall on, Snowden sparked a public debate on how much information the government can collect,” Sagar said.

Related: Russia Considers Returning Snowden to U.S. to ‘Curry Favor’ With Trump: Official

“The disclosure did serve a public purpose, and many would say it was ethically defensible,” said Kathleen Clark, a professor at Washington University School of Law. “You are not supposed to leak information, but that doesn’t mean it's criminal,” she said.