Embattled EPA chief Scott Pruitt resigned under mounting pressure on Thursday — as the number of ethical controversies over his personal and professional behavior continued to pile up.

President Trump, who had been one of the former Oklahoma attorney general’s staunchest defenders, announced the resignation in a pair of laudatory tweets.

“I have accepted the resignation of Scott Pruitt as the Administrator of the Environmental Protection Agency. Within the Agency Scott has done an outstanding job, and I will always be thankful to him for this,” Trump wrote.

The president later told reporters that Pruitt is “a terrific guy” and that the decision was Pruitt’s alone.

“There was no final straw. Scott is a terrific guy. He came to me and he said, ‘Look, I have such great confidence in the administration. I don’t want to be a distraction,’” he said.

“It was very much up to him. He’ll go on to great things and he’s going to have a wonderful life.”

Pruitt was facing 13 congressional ethics investigations over his lavish spending of taxpayer money on security and first-class flights, as well as a sweetheart deal he cut on a DC condo owned by a lobbyist whose husband had business with the EPA.

In a resignation letter issued to media outlets, Pruitt heaped praise on the president and expressed no regret for any of his own actions.

“It is extremely difficult for me to cease serving you in this role first because I count it a blessing to be serving you in any capacity, but also, because of the transformative work that is occurring,” Pruitt wrote.

“However, the unrelenting attacks on me personally, my family, are unprecedented and have taken a sizable toll on all of us.”

Trump said in a second tweet that Deputy Administrator Andrew Wheeler, a former coal industry executive, will assume the acting administrator position at the EPA on Monday.

“I have no doubt that Andy will continue on with our great and lasting EPA agenda. We have made tremendous progress and the future of the EPA is very bright!” Trump wrote.

Pruitt’s resignation came days after two of his former senior staffers spoke to House Oversight Committee investigators and made new allegations about how he conducted himself.

Samantha Dravis, Pruitt’s former policy chief at the EPA, told the investigators last week that he had made clear to her before and after he became administrator that he wanted the attorney general’s job, held then and now by Jeff Sessions.

Pruitt denied her account.

During his one-year tenure, Pruitt crisscrossed the country to speak with industry groups and hobnob with GOP donors, but he showed little interest in listening to advocates he derided as “the environmental left.”

The feeling was mutual.

“Despite his brief tenure, Pruitt was the worst EPA chief in history,” said Kieran Suckling, executive director of the Center for Biological Diversity.

“His corruption was his downfall, but his pro-polluter policies will have our kids breathing dirtier air long after his many scandals are forgotten.”

Like Trump, Pruitt is a climate-change skeptic and a fierce critic of the Paris climate agreement, from which Trump withdrew.

The president cheered his EPA chief’s moves to reverse Obama-era environmental rules that corporations opposed, boost fossil fuel production and roll back regulations that barred mining and other commercial activity on what had been protected federal lands.

Pruitt quit following a series of revelations involving pricey first-class air travel and unusual security spending, including a $43,000 soundproof booth for making private phone calls from his office.

He also had ordered his EPA staffers to do personal chores and enlisted them to contact conservative groups and companies to find a job for his unemployed wife.

In each instance, he denied any wrongdoing.

With Post wires