WASHINGTON — Michael T. Flynn was a man seething and thwarted. In the summer of 2014, after repeatedly clashing with other Obama administration officials over his management of the Defense Intelligence Agency — and what he saw as his unheeded warnings about the rising power of Islamic militants — Mr. Flynn was fired, bringing his military career to an abrupt end.
Mr. Flynn decided that the military’s loss would be his gain: He would parlay his contacts, his disdain for conventional bureaucracy, and his intelligence career battling Al Qaeda into a lucrative business advising cybersecurity firms and other government contractors. Over the next two years he would sign on as a consultant to nearly two dozen companies, while carving out a niche as a sought-after author and speaker — and ultimately becoming a top adviser to President Trump.
“I’ve always had that entrepreneurial spirit,” Mr. Flynn said in an interview in October 2015. In the military, he added, “I learned that following the way you’re supposed to do things isn’t always the way to accomplish a task.”
But instead of lofting him into the upper ranks of Beltway bandits, where some other top soldiers have landed, his foray into consulting has become a legal and political quagmire, driven by the same disdain for boundaries that once propelled his rise in the military. His business ties are now the subject of a broad inquiry by a special counsel investigating Russian interference in the 2016 election and possible collusion with Trump associates. That investigation now includes work Mr. Flynn did for Russian clients and for a Turkish businessman with ties to that country’s president, Recep Tayyip Erdogan.
Mr. Flynn sometimes seemed to be trying to achieve through business what he could not accomplish in government. He believed that the United States was engaged in a “world war” against Islamist militants, and that Washington’s national security elite had so thoroughly politicized the country’s intelligence agencies that few left in government could see the threat. The United States, he believed, needed to take a tougher line against the Islamic State, and it needed to cultivate Russia as an ally in the fight.
“He got out of the service and had a passion to reform the intelligence community, where he saw some deficiencies,” said Todd Wilcox, a former Green Beret and C.I.A. officer who founded Patriot Capital, a Florida-based defense contractor that named Mr. Flynn to an advisory board in 2015.
But Mr. Flynn also became entangled with controversial clients. One company that paid him, OSY Technologies, is part of a cyberweapons company whose software has been used to hack Mexican activists and an opposition leader in the Middle East. Another, a Boston company selling a technology to replace lie detectors, is accused by its former chief scientist of marketing a counterfeit version of his technology to foreign clients.
Dozens of interviews and a review of public documents suggest that Mr. Flynn’s business was as scattershot as it was ambitious — and that there were few opportunities he would pass up. His clients ranged from a drone manufacturer in Florida to major software companies; at one point, Mr. Flynn took a $5,000 gig as an expert witness in a personal injury case. Some of his clients came through a tight-knit circle of Iranian-Americans, one of whom became a key partner in Mr. Flynn’s businesses.
Mr. Flynn’s work paid well — while it lasted. Financial disclosure forms released in March showed income of between $1.37 million and $1.47 million for a period that roughly covered 2016, the bulk of it from the Flynn Intel Group.
Mr. Flynn closed the Flynn Intel Group at the end of 2016, as he planned to join the Trump administration. But within months, he was fired as Mr. Trump’s national security adviser; the White House has said he was forced out for misleading Vice President Mike Pence about the nature of conversations he had with the Russian ambassador to the United States. Now under scrutiny by the F.B.I. and congressional investigators, Mr. Flynn faces legal bills that are well into the six figures, and former clients are scrambling to distance themselves from the ex-general whose counsel they once avidly sought.
Mr. Flynn declined to comment for this article, and his lawyer, Robert Kelner, declined to answer questions from The New York Times. But in an interview not long ago, Mr. Flynn expressed pride in his moneymaking skills. “I’m a capitalist at heart,” Mr. Flynn said in October. “If I’ve discovered anything, it’s that I’m a good businessman.”
A New Consulting Business
In the fall of 2014, Mr. Flynn registered his new company, Flynn Intel Group, from an Alexandria, Va., townhouse owned by Stanley A. McChrystal, a friend and fellow general-turned-consultant. Among his first clients was Palo Alto Networks, a rising Silicon Valley firm seeking to win more government contracts. A few months later, he inked a deal with the software giant Adobe, which paid him a six-figure fee to provide “periodic counsel to Adobe’s public sector team,” according to a company spokeswoman.
But Mr. Flynn also joined the board of a little-known company called GreenZone Systems, which marketed secure mobile communications systems. GreenZone was run by Bijan R. Kian, an Iranian-American businessman who served until 2011 as a director of the U.S. Export-Import Bank. A friend of Mr. Kian, the businessman Nasser Kazeminy, also hired Mr. Flynn as an adviser.
Mr. Flynn and Mr. Kian soon found a third partner: Philip Oakley, a former Army intelligence analyst, longtime Flynn friend, and owner of two small companies that provided software for defense and intelligence clients. They restarted Flynn Intel Group in June 2015, according to Delaware corporate records, pitching themselves as a premier private intelligence and cybersecurity advisory firm.
None of the partners responded to repeated attempts to contact them. But their business interests were closely intermingled. Beginning in 2015, Mr. Oakley’s firms employed Mr. Flynn as an adviser and paid him $90,000 in salary over 11 months.
Jim McGuire, a business partner of Mr. Kazeminy, said in an email that Mr. Flynn had provided guidance on public sector business opportunities.
Mr. McGuire declined to say whether GreenZone had won any government business during Mr. Flynn’s tenure as an adviser, which ended last fall. If Mr. Oakley thought joining with Mr. Flynn would turbocharge his business, he may have been disappointed: Mr. Oakley’s companies do not appear to have received any new contracting work directly from the federal government, though government databases do not reliably include subcontractors.
Mr. Flynn continued to collect advisory board memberships, however: His credentials were a marketable asset. Fledgling contractors like Patriot Capital, Mr. Wilcox said, use advisory boards to “build some gravitas.”
Links to Russian Firms
Yet even as Mr. Flynn consulted for American cybersecurity companies, he was developing closer financial ties to Russia, a country whose own intelligence apparatus was moving aggressively to penetrate United States government systems. In 2015, Mr. Flynn accepted a payment from Kaspersky Lab, a Russian research firm that works to uncover Western government spyware and whose founder has long been suspected of having ties to Russian intelligence services.
In 2015, the firm’s American subsidiary, Kaspersky Government Security Solutions Inc., paid him $11,250. The same year, Mr. Flynn received the same amount from Volga-Dnepr Airlines, a Russian carrier that has been examined by the United Nations for bribery.
Both payments were for unspecified “services” provided by Mr. Flynn, according to a letter sent to the White House in March by Representative Elijah E. Cummings of Maryland, the top Democrat on the House Oversight Committee, which is examining Mr. Flynn’s financial dealings. Kaspersky has said that Mr. Flynn was paid for remarks he delivered at a 2015 cybersecurity forum in Washington.
In December 2015, Mr. Flynn traveled to Moscow for a paid speaking engagement on behalf of RT, the Kremlin-financed news network that American intelligence agencies say is a Russian propaganda outlet. RT paid Mr. Flynn $45,000 for the trip, which also included an invitation to a lavish anniversary party for the network, where he was photographed sitting at the elbow of President Vladimir V. Putin.
The three payments from Russian companies are among the issues being investigated by Robert S. Mueller III, the special counsel leading the Justice Department inquiry.
Mr. Flynn believed that Moscow could be cultivated as an ally against Islamist militants. As director of the Defense Intelligence Agency, he had even visited the headquarters of the G.R.U., the Russian military intelligence service.
His colleagues in the American intelligence community took a less favorable view, especially when he continued to push for closer ties after Russia’s seizure of Crimea in 2014. They believed Mr. Flynn was willing to be used by Russia if he could advance his views on forging a united front to battle the Islamic State.
A Growing List of Clients
By early 2016, Mr. Flynn’s public profile was rising. He had signed a book deal and began hitting the public speaking circuit. The rise of the Islamic State in Iraq and Syria seemed to validate his criticism of Obama administration policy, and Mr. Flynn soon become a regular adviser to Mr. Trump’s insurgent presidential campaign.
But behind the scenes, his client list was also expanding.
That May, Mr. Flynn joined the advisory board of OSY Technologies, part of the NSO Group, a secretive cyberweapons dealer founded by former Israeli intelligence officials. He also consulted with Francisco Partners, an American private equity firm that controls NSO Group.
The same year, the company’s products were linked to an attempt to hack the cellphone of Ahmed Mansoor, a human rights activist in the United Arab Emirates. They were also used to harass public health advocates of a Mexican soda tax, who began receiving threatening text messages.
In a statement, NSO said it “only develops the software, and is not involved in any way, shape or form in operating the system.”
Steve Eisner, the general counsel of Francisco Partners, suggested that Mr. Flynn had served the company in a relatively limited advisory role.
“We routinely engage consultants to help us understand industries that we are investing in,” Mr. Eisner said. Mr. Flynn was paid a little more than $40,000 by OSY, and “less than $100,000” by Francisco, Mr. Eisner said.
Another client was Brainwave Science, a tiny Massachusetts company that purports to have technology that can scan the brain to determine if someone is lying.
Dr. Lawrence A. Farwell, the company’s former chief scientist and inventor of its technology, said in an interview that Brainwave was using a counterfeit version of his work and was the target of a federal investigation related to its product. He declined to provide further details.
A man previously listed as one of the company’s board members, Subrahmanyam M. Kota, the head of an I.T. consulting firm called the Boston Group, was caught in a sting in the 1990s and accused of trying to sell secrets to the K.G.B. As part of a deal that involved his testimony against another defendant, he eventually pleaded guilty to charges related to theft and tax evasion.
Mr. Kota denied in an interview that he had served on the board of Brainwave; Dr. Farwell said Mr. Kota was actually the principal investor. A lawyer for Brainwave declined to answer questions about the dispute with Dr. Farwell or Mr. Flynn’s work for the company.
Dr. Farwell added that he had warned Mr. Flynn against getting involved with the company. “I’m not going to make any representations as to what Flynn’s positions or words were, but I was in communication with him directly, and with his staff,” Dr. Farwell said.
A Slapdash Effort
By the fall of 2016, Mr. Flynn was spending significant time on the campaign trail with Mr. Trump. Back in Washington, Mr. Kian brought in a new client: A prominent Turkish businessman named Ekim Alptekin, who headed a Turkish trade association with ties to the country’s government.
Mr. Alptekin had come to know Mr. Kian during Mr. Kian’s days at the Export-Import Bank, Mr. Alptekin said in an interview this month. Last fall, after the failed July 2016 coup against the Turkish president, he wanted to fight back against those whom Mr. Erdogan blamed for the attempt: members of the Islamic religious movement led by Fethullah Gulen, a Turkish cleric who has lived in Pennsylvania since 1999.
“Like many Americans rolling up their sleeves in 9/11 to do something, I decided to do something,” Mr. Alptekin said.
His public explanations for hiring the Flynn Intel Group have not always been consistent: In March, he told a reporter that Mr. Flynn had been hired “to produce geopolitical analysis on Turkey and the region” for an Israeli energy company.
Mr. Alptekin now says that he wanted to hire a credible American firm to lead a public relations campaign against the Gulenists. Mr. Kian suggested the Flynn Intel Group, Mr. Alptekin said — though without disclosing his own involvement with the firm.
“You need independent work; you need research that is done by Americans,” Mr. Alptekin said. “Flynn was well credentialed; he was a head of D.I.A.”
The Flynn Intel Group promised what sounded like a sophisticated research and lobbying effort, employing former intelligence and military veterans, and led by Mr. Flynn himself. The company would produce a documentary and seek to persuade members of Congress that Mr. Gulen ought to be extradited. Mr. Alptekin agreed to pay $600,000 for the work.
But the effort appears to have been slapdash from the start, according to several people involved in the effort, who asked for anonymity because of the continuing federal investigations.
Mr. Flynn had little to say during meetings, though he would hand out signed copies of his book at each one. A former United States intelligence operative named Mike Boston appeared to be quarterbacking the assignment, but according to one person involved, he mostly sat in the corner or paced around the room saying nothing.
Mr. Flynn’s partners also appeared unsure of what legal requirements they faced, according to another person involved in the project. Yet another Kian friend, a lawyer named Robert Kelley, was brought in for advice, and later filed a lobbying disclosure on the company’s behalf, indicating that its client was Mr. Alptekin’s company, Inovo BV.
Mr. Kian later disclosed that he met twice in October 2016 with staff members for the House Committee on Homeland Security. According to a report in The Daily Caller, Mr. Kian at first pitched them on technology developed by GreenZone, the contracting firm he also ran. But at the second meeting, Mr. Kian initiated a discussion of the Gulen research, surprising the Hill staffers.
Mr. Flynn did not attend those meetings. But the day after the election, he published an op-ed calling Mr. Gulen “a shady Islamic mullah” and comparing his movement to the Muslim Brotherhood. Mr. Alptekin said he advised Mr. Kian against publishing the op-ed and that the Flynn Intel Group eventually refunded the lobbying portion of his payments.
But the op-ed caught the attention of Justice Department lawyers, who opened an investigation into whether Mr. Flynn was in fact working as a paid lobbyist for Turkey — a matter that is now part of Mr. Mueller’s broader inquiry into Mr. Trump’s inner circle.
Months later, in March, Mr. Flynn and Mr. Kian filed additional disclosures under the Foreign Agents Registration Act. The new disclosures acknowledged that the Gulen project “could be construed to have principally benefited the Republic of Turkey.”
Around $270,000 worth of the fees Mr. Alptekin paid to Flynn Intel Group are not accounted for in the foreign agent disclosure, which details payments to roughly a dozen other individuals and firms associated with the Gulen project.
Mr. Alptekin says he does not know where the money went.
A version of this article appears in print on June 18, 2017, on Page A1 of the New York edition with the headline: Flynn’s Disdain For Limits Led To a Legal Mire.