In the wake of last weekend’s mass shootings, President Trump told lawmakers and aides privately that he is open to endorsing background checks — but the NRA chief warned him that a bill would be unpopular among his supporters, according to a report.

On Wednesday, Trump gave a green light to background check legislation, saying he thinks there is an “appetite” for the measure after the mass shootings in El Paso and Dayton that claimed 31 lives.

“I think background checks are important,” the president told reporters before trips to Ohio and Texas to meet with survivors of the shootings.

National Rifle Association chief executive Wayne LaPierre spoke with Trump on Tuesday after the president expressed support for the measure — and told him it would be unpopular with his voter base, sources told the Washington Post on condition of anonymity.

NRA spokeswoman Catherine Mortensen told The Post in an email: “It is long-standing policy that we do not comment on private meetings.”

A gun violence prevention group reacted to LaPierre’s reported warning by noting that “poll after poll shows overwhelming support for background checks, including among Republican voters.”

“More than 90 percent of Americans, including 90 percent of Republicans, support background checks on all gun sales — so President Trump should say no to the floundering NRA and yes to the American people,” John Feinblatt, president of Everytown for Gun Safety, said in a statement.

“Remember: He favored bold action after Parkland, until Wayne LaPierre started whispering in his ear. If the president is serious about leading now, then he’ll break with the NRA and tell Majority Leader McConnell to bring the Senate back and pass background checks and Red Flag legislation.”

Since the shootings Saturday and early Sunday, the president has called lawmakers and questioned his aides about what actions he should take, according to the Washington Post.

White House officials said acting chief of staff Mick Mulvaney convened a series of meetings to discuss the matter, the newspaper reported.

Trump has discussed with aides the idea of a bill-signing ceremony for gun control legislation in the Rose Garden, but many in the West Wing view such action as premature, according to the report.

The president also asked lawyers about what he could push through by executive order, officials told the news outlet.

Advisers to Senate Majority Leader Mitch McConnell said he would not bring any gun control legislation to the floor without widespread support in the ranks of the GOP.

The gun rights group opposes legislation sponsored by Sens. Patrick J. Toomey (R-Pa.) and Joe Manchin III (D-W.Va.) that would expand background checks to almost all firearm sales. Even some supporters of the Manchin-Toomey bill say it is unlikely to pass.

“I don’t think the president or his Republican allies are going to become out of nowhere advocates of aggressive gun control,” said Trump ally Matt Schlapp, who leads the American Conservative Union, the Washington Post reported.

Sen. Lindsey Graham (R-SC), chairman of the Senate Judiciary Committee, said the president “seems determined to do something and believes there is space to get something done this time around.”

“The president has a pretty common-sense point of view. He’s never been a sports or gun enthusiast. But he is more determined than ever to do something on his watch,” said Graham, adding that he had spoken to Trump “four or five times” since the shootings.

Manchin said Trump told him on Tuesday that he wanted legislation before September — but did not express explicit support for the bill as he asked a series of questions.

“He was inquisitive, wanting to know why it hadn’t happened. He wanted to know all about it,” Manchin told the paper. “I told him we couldn’t get enough Republicans to help us.”

Manchin said he told the president that he would need to endorse any gun control legislation or it would fail again — comments that were mirrored by multiple Republicans and White House aides.

“If you don’t stand up and say, ‘This is a piece of legislation I support,’ we’re not going to get enough cover to have Republicans stand tall. They won’t be able to do it,” Manchin said.

Trump later outlined some of the NRA’s concerns about the legislation.

“I told him, we don’t expect the NRA to be supportive. ‘Mr. President, in all honesty, when you did the bump stocks, they weren’t for you. They were against that, too. You didn’t take any hit on that,’” Manchin told the Washington Post.

In March, the administration banned bump stocks, devices that make semi-automatic rifles fire rapidly like fully automatic machine guns.

Roughly 9 in 10 Americans support background checks for all gun purchases — including more than 8 in 10 Republicans, Democrats and independents, according to polls.

After the deadly Parkland, Fla., shooting in February 2018, the president expressed support for background checks and greater police power to seize guns from mentally disturbed people. But amid resistance from the NRA and Republicans, he abandoned the ideas.

Nikki Schwab and Marisa Schultz contributed reporting