The Trump White House’s escalating attacks on the news media after a string of journalism errors this month resemble assaults by Richard Nixon’s administration against The Washington Post when it made a mistake in a story about Watergate.

The president’s recent attacks began when Brian Ross of ABC News incorrectly reported on Dec. 1 that Donald Trump told national security aide Michael Flynn to contact Russian officials during the 2016 presidential campaign. Four days later, the Wall Street Journal, Bloomberg and other news outlets erred when they said that special counsel Robert S. Mueller III had subpoenaed Deutsche Bank for Trump’s financial records.

Then CNN mistakenly reported that Donald Trump Jr., the president’s son, knew in advance that WikiLeaks was going to release documents stolen from the Democratic National Committee. And Washington Post reporter Dave Weigel posted an inaccurate tweet on Dec. 9 about a Trump rally in Florida. In response, Trump demanded a retraction from “FAKE NEWS WaPo,” and press secretary Sarah Huckabee Sanders accused journalists of sometimes “purposely misleading the American people.” Even though Weigel readily apologized, Trump demanded that The Post fire him, which the paper declined to do.

These errors, and Trump’s eager celebration of them, recall a crucial moment when a reporting blunder almost stymied the most important political investigation in American media history — Watergate. After The Post made an embarrassing mistake in an October 1972 story about powerful White House Chief of Staff H.R. “Bob” Haldeman, press secretary Ronald Ziegler spent a half hour angrily denouncing the newspaper on behalf of the Nixon administration.

At the time, the Watergate scandal was drawing closer to Nixon’s inner circle, and the error became an opportunity for Nixon’s team to try to derail The Post’s investigation into widespread misconduct by his administration and reelection campaign.

And it almost worked. But the Post was able to recover by quickly figuring out what went wrong, making sure its reporters were careful to avoid similar mistakes and refusing to be intimidated by White House threats. Today’s journalists would do well to remember these lessons.

In the four months before the Haldeman story, Post reporters Bob Woodward and Carl Bernstein had made astonishing revelations about the involvement of people connected with the Nixon campaign and administration in burglary, domestic spying, evidence destruction and dirty tricks. As I explain in my book “Watergate’s Legacy and the Press: The Investigative Impulse,” they channeled the investigative spirit that had been building in journalism since the 1960s, as skepticism about government soared during the Vietnam War. And they used careful and relentless shoe-leather reporting to challenge the statements of the most powerful men in the country.

While most members of the Washington press corps focused on reporting the words of top officials, Bernstein and Woodward went to the homes of low-level campaign workers, coaxing them to share the truth about the actions of their bosses. The two reporters followed the trail of money that led to the top levels of the White House and Nixon’s campaign, slowly putting together the pieces of the scandal.

They were persistent, and they were right. As a result, they gained the trust of other sources who gave them additional information that gradually exposed the Watergate crimes to the public.

Nixon responded with an all-out assault against The Post, determined to undermine the newspaper’s credibility and weaken its finances. His aides pushed the Internal Revenue Service to investigate the tax returns of Post owner Katharine Graham and the paper’s lawyer, Edward Bennett Williams. Nixon also ordered his aides to “screw around” with the broadcasting licenses of two lucrative televisions stations owned by The Post.

And then The Post gave an administration all too happy to use dirty tricks an opening. It published the Haldeman story on Oct. 25, 1972, allowing Nixon’s staff to pounce on a small error to question publicly the paper’s credibility. Bernstein and Woodward wrote that Haldeman “was one of five high-ranking presidential associates authorized to approve payments from a secret Nixon campaign cash fund, according to federal investigators and accounts of sworn testimony before the Watergate grand jury.”

The fund had been used for sabotage and espionage against the president’s opponents, including payments to the men who burglarized the Democratic National Committee’s headquarters at the Watergate office complex, Bernstein and Woodward wrote. If Haldeman was guilty, then it was only a small step to connect the Watergate crimes to Nixon himself.

Although the main point of the story was true, Nixon’s aides jumped on the mistake: Bernstein and Woodward wrote that former Nixon campaign treasurer Hugh Sloan Jr. had testified before a grand jury about Haldeman’s control of the fund. Sloan had indeed told Bernstein and Woodward about Haldeman’s role, but he had not told the grand jury.

As Trump and his associates have done with articles about the Russia investigation, Ziegler and other Nixon spokesmen regularly denied the allegations contained in the stories of Bernstein, Woodward and other reporters. Former Post city editor Barry Sussman explained in his book, “The Great Cover-Up: Nixon and the Scandal of Watergate,” that the Haldeman story gave Nixon’s associates a specific error they could attack. Bernstein and Woodward had misinterpreted what Sloan, the former campaign treasurer, had said and had relied on the confused answers of an FBI agent to falsely conclude that Sloan had testified about Haldeman before the grand jury.

Nixon’s men used the error to disparage all of the newspaper’s Watergate reporting. At his news briefing that day, Ziegler accused The Post of engaging in “shoddy and shabby” journalism and called the article a “blatant effort at character assassination.” Clark MacGregor, director of Nixon’s reelection effort, charged that The Post was “operating in close philosophical and strategic cooperation” with the campaign of Democratic presidential candidate George McGovern.

FBI Associate Director W. Mark Felt, who was later revealed to be The Post’s secret Watergate source known as “Deep Throat,” told Woodward that the error would damage the Watergate investigation. “You’ve got people feeling sorry for Haldeman,” Felt said. “I didn’t think that was possible.”

Bernstein and Woodward feared that their credibility was lost and talked of resigning. Still, The Post’s executive editor, Ben Bradlee, publicly supported his reporters, announcing, “We stand by our story.”

Instead of being controlled by a corporate conglomerate, as most large news outlets are today, The Post was independently owned by Graham, who courageously backed her journalists. Graham and Bradlee knew that if The Post published more mistaken stories like the Haldeman one, the newspaper’s reputation would be destroyed and its survival uncertain. But they also understood the role of a free press in a democracy, and they were not going to let government bullying stop their reporters.

Woodward and Bernstein’s persistence against White House intimidation has inspired journalists since Watergate. But their accuracy should as well. During the Watergate investigations, Bradlee, Sussman and The Post’s other editors double- and triple-checked every story. They insisted that Woodward and Bernstein have at least two reliable sources for every claim in a story and would quiz them about each one. Sometimes they held back a story from the next day’s newspaper if they were not fully confident of the facts.

Learning their lesson from the Haldeman story, Bernstein and Woodward continued their investigations without another major mistake, and of course it was Nixon who was forced to resign in August 1974.

The blunders of the past month could have been avoided if journalists used similar standards today. At a time when anyone with a smartphone can spread information, or misinformation, around the world in an instant, intense pressure exists to quickly post stories that will stand out from the crowd, or at least tweet scoops long before a full story is complete. Reporters must resist this competitive urge to rush stories until they make sure they fully understand and verify everything sources say. It’s better to be right than first.

To be sure, Mueller’s investigation will continue whether or not journalists make more mistakes, just as the FBI and special prosecutors relentlessly pursued Watergate. But the impact of Mueller’s investigation on public opinion, Congress and Trump’s political fortunes depends heavily on media coverage.

As the stakes grow higher, the importance of getting the facts absolutely correct increases. Like everybody else, journalists aren’t perfect, but they do need to aim for perfect accuracy in every story. If reporters don’t minimize mistakes, like Bernstein and Woodward did, Trump and his supporters will find it easier to dismiss any allegations against them.