Carl Icahn resigned from his post as special advisor on regulation to Donald Trump ahead of a critical magazine article detailing his potential conflicts of interest and questioning whether he had acted illegally.

CNBC originally published an investigation on the matter in December.

The new New Yorker piece centered on how the billionaire investor, who announced his departure from the role on Friday, had been pushing to change part of a rule that has a negative impact on one of his energy investments.

Icahn said that he resigned from the role to avoid "partisan bickering" about his position. The billionaire investor said he did not want that scrutiny to affect the Trump administration's work on regulatory reform.

And in a personal defense, Icahn wrote in his resignation: "I never had a formal position with your administration nor a policymaking role. And contrary to the insinuations of a handful of your Democratic critics, I never had access to nonpublic information or profited from my position, nor do I believe that my role presented conflicts of interest."

"Indeed, out of an abundance of caution, the only issues I ever discussed with you were broad matters of policy affecting the refining industry. I never sought any special benefit for any company with which I have been involved, and have only expressed views that I believed would benefit the refining industry as a whole," he added.

Still, former White House ethics lawyers had told CNBC that Icahn's appointment to the informal role, given his stake in refiner CVR Energy, represented a conflict of interest and could have put him at risk of violating conflicts laws.

The rule in question requires refiners to blend ethanol, a renewable fuel, into gasoline. In an interview on CNBC's "Fast Money: Halftime Report," Icahn said the Environmental Protection Agency should immediately revoke part of the rule that requires refiners that cannot blend ethanol into gasoline to buy credits instead.

If Icahn's advice in his capacity as special advisor on regulation contributed to such a repeal, he would have inherently aided in removing a disadvantage for CVR Energy. Repeal of the regulation could have potentially boosted CVR's stock price and enrich Icahn.

The markets were anticipating Icahn would help shape rules that would benefit CVR: Shares of the company rose 11.5 percent after Trump named him to the role. Icahn Associates held 82 percent of CVR Energy's outstanding shares at the time, according to FactSet data.

The Trump team did not return CNBC's phone call or emails requesting comment for its original investigation into Icahn.

Earlier, the Trump transition team said Icahn "will be advising the President in his individual capacity and will not be serving as a federal employee or a Special Government Employee and will not have any specific duties."

Still, Norman Eisen, the former chief ethics lawyer to President Barack Obama, said before Trump took office that Icahn should beware because the situation may pose a violation of conflict of interest and other laws, some of which could carry a criminal penalty. He said Icahn's duties may go beyond informal advising, given that he has a formal title as special advisor, sweeping responsibilities and potentially influence over personnel choices.

"It appears that he may end up as a de facto special government employee. As such, he would be subject to the conflicts rules, including under 18 USC 208," Eisen told CNBC at the time, referring to a law that restricts people with a financial interest from advising the president.

"If so, that would make him potentially criminally liable if he worked on a repeal of the ethanol mandate that would boost CVR's stock price and enrich him. Of course, that's a lot of ifs, and we have to see what his actual conduct is," said Eisen, a fellow at the Brookings Institution.

In a statement to CNBC for its December investigation, Jesse Lynn, general counsel at Icahn Enterprises, said, "Mr. Icahn is well aware of his obligations under the law generally and with respect to 18 U.S.C. 208 specifically. He will follow the law as he always has."

He reiterated the Trump Team's message that "unlike a government employee, [Icahn] will have no official role or duties." He added that Icahn will not be in a position to set policy, but will instead offer suggestions.

In the New Yorker article, Lynn reiterates that Icahn held no official government role and was "not in a position to set policy."