In the months leading up to the agreement, as his legal fate hung in the balance, Smith told Vista insiders his tax dispute was strictly a personal matter, people familiar with the conversations said. He hosted lavish holiday celebrations in December 2019 for clients and employees, including a New York-themed party celebrating his firm’s 20th anniversary at an airport hangar in Smith’s hometown of Austin.

But things weren’t looking good. Around that time, prosecutors told Smith’s lawyers they had enough evidence to bring criminal tax charges, two people with knowledge of the discussions said.

It’s also when some people close to Vista say they first heard talk of a national security matter that might help Smith avoid tax charges. Smith’s legal team, which had been working its way up the tax division hierarchy, swung into high gear, arguing for a civil settlement.

Vista had long counted on Kirkland, one of the world’s largest law practices, as its main legal adviser. The private equity firm, which buys and sells enterprise software companies, generates annual billings for Kirkland of about $80 million, according to people with knowledge of the matter. Its chief operating officer, David Breach, who’s also the firm’s top lawyer, had been a partner at Kirkland. The firm represents some of the biggest corporations and private equity companies, including Blackstone, Carlyle Group and KKR. Filip, who works out of the Chicago office, has helped negotiate settlements for BP and Boeing. Another partner, Norm Champ, a former head of the Securities and Exchange Commission’s investment management division, was involved in discussions about whether Smith could remain at Vista given the serious nature of the findings, two people familiar with the matter said.

In addition to attorneys from Kirkland, there were lawyers from Caplin & Drysdale, a leading U.S. tax shop, and Skadden, Arps, Slate, Meagher & Flom. Smith also retained Kenneth Wainstein, who previously led the Justice Department’s national security division. Reid Weingarten, one of the country’s top white-collar trial attorneys, was prepared to try the case if Smith were indicted.

By the end of 2019, Smith’s lawyers secured a meeting with the department’s top tax officials to make their case. It then went to Barr, who also considered the national security matter, people familiar with the discussions said. Assistant Attorney General for National Security John Demers got involved, and Barr eventually weighed in, telling tax and national security officials to resolve the dispute between their divisions, according to the people. Barr also made it clear that for Smith to avoid indictment, he would have to cooperate against Brockman and pay a hefty penalty.

Over the next few months, as the Covid-19 pandemic swept across the U.S., Smith raised his public profile. He joined President Donald Trump and Vice President Mike Pence in March to discuss the economy with fellow billionaire financiers Ken Griffin, Dan Loeb and Stephen Schwarzman. And he praised White House efforts to get Cares Act assistance to minority communities.

In a May 10 appearance on Meet the Press, Smith said Treasury Secretary Steven Mnuchin and Ivanka Trump were “very engaged” in the effort. He started having daily calls with Mnuchin and weekly ones with the president’s daughter, the Washington Post reported in June, quoting her saying she’d had “very substantive discussions” with Smith about supporting businesses in minority communities. Smith “didn’t have a particular agenda” and was “legitimately interested in helping the program,” Mnuchin told the paper. “You know, the dynamic I’ve been focused on is working with the administration, with Ivanka and Secretary Mnuchin in particular, as well as on both sides of the aisle,” Smith said on Fox Business on June 17.

Smith’s open support of the Trump administration didn’t seem to influence the Justice Department. In June, prosecutors told his lawyers they were still planning to indict Smith on charges of conspiracy and filing false tax returns, three of the people familiar with the discussions said.

Smith’s lawyers continued to push for a non-prosecution agreement, and the case went to Barr a second time, people with knowledge of the matter said. Again, the attorney general drew a line: He told Zuckerman, the top tax prosecutor, that he would green-light an indictment if Smith didn’t agree to cooperate fully against Brockman and pay a sizable penalty, one person said.

In July, Smith’s team made a direct appeal to Barr, according to people with knowledge of the matter. It isn’t known what was said in that meeting, or whether the national security matter came into play. But on July 21, Zuckerman reached out to Filip to set up a conference call, saying the Justice Department’s tax division “will not be presenting the indictment of Mr. Smith to a grand jury at this time,” according to an email reviewed by Bloomberg.

The call two days later was the first step in negotiations that would lead to the agreement Smith signed in early October and that the Justice Department announced later that month, along with Brockman’s indictment. Barr approved the deal after tax prosecutors assured him they were satisfied with Smith’s offer, according to a person familiar with the discussions. The agreement also had the advantage of keeping the national security matter under wraps.