After mounting pressure from President Trump and many others, heavily endowed Harvard University finally caved on Wednesday and said it would return the $8.6 million in coronavirus relief it received from the federal government.

“Harvard will not accept funds from the CARES Act Higher Education Emergency Relief Fund. Like most colleges & universities, Harvard has been allocated funds as part of the CARES Act. Harvard did not apply for this support, nor has it requested, received or accessed the funds,” the school tweeted.

But the Ivy League school — which has an endowment of $40.9 billion — also bemoaned the political pressure.

“We are concerned that intense focus by politicians & others on Harvard in connection with the program may undermine participation in a relief effort Congress created & the president signed into law for the purpose of helping those whose financial challenges may be most severe,” Harvard whined.

“As a result of this, and the evolving guidance being issued around use of the Higher Education Emergency Relief Fund, Harvard has decided not to seek or accept the funds allocated to it by statute.”

The university had earlier said it would not return the funds, and stressed that it had not gotten any cash from the Paycheck Protection Plan, created to help small businesses struggling to survive during the pandemic.

Instead, the upper-crust school had argued, it applied for and received money from another fund specifically geared to colleges and universities.

“President Trump is right that it would not have been appropriate for our institution to receive funds that were designated for struggling small businesses,” the school tweeted before the about-face.

“Like most colleges and universities, Harvard has been allocated funds as part of the CARES Act Higher Education Emergency Relief Fund.”

Trump on Tuesday demanded that Harvard return $8.6 million it received in coronavirus relief funding.

“Harvard’s going to pay back the money,” the president said after being asked about the award at the daily Coronavirus Task Force briefing.

“They shouldn’t be taking it. I’m not going to mention any other names, but when I saw Harvard — they have one of the largest endowments anywhere in the country, maybe in the world, I guess. They’re going to pay back that money.”

The issue surfaced after the Shake Shack chain said it would return cash it had received that had been intended for small businesses.

The Higher Education Emergency Relief Fund included about $14 billion of the $2.2 trillion stimulus package Trump signed last month.

Harvard had said it was using all of the money it received to “provide direct assistance to students facing urgent financial needs due to the COVID-19 pandemic.”

“This financial assistance will be on top of the support the University has already provided to students — including assistance with travel, providing direct aid for living expenses to those with need, and supporting students’ transition to online education,” Harvard said.

Stanford University in Palo Alto, California, another top American university with a high endowment, said it would return the funds, and that it contacted the Department of Education to ask for its application for the cash to be “rescinded.”

Ivy League Princeton also said it would not take funding under the CARES Act.

“Princeton has not yet received any of these funds, and never requested any of these funds,” the school said on Twitter.

Even some alums were upset with Harvard.

“Just because the law was written to make the money available does not mean it was moral to take it,” Danielle Leonard, a lawyer in San Francisco, told Boston.com.

She said the university had many options other than accepting public money, including loans to support students and pay employees and staff members.

Harvard “does not need a grant of public funds to do that,” she added.