WASHINGTON — Polite yet firm, Senate Republicans told President Barack Obama on Thursday to tone down his political attacks and prod Democratic allies to support controversial changes in Medicare if he wants a compromise reducing deficits and providing stability to federal benefit programs.

Participants at a 90-minute closed-door meeting said Obama acknowledged the point without yielding ground — and noted that Republicans criticize him freely.

“To quote an old Chicago politician, ‘Politics ain’t beanbag,’ ” the president said.

The discussion came as Obama wrapped up a highly publicized round of meetings with rank-and-file lawmakers in both parties and both houses of Congress in hopes of building support for a second-term agenda of deficit reduction, immigration overhaul and gun control.

Obama met with Senate Republicans and House Democrats as legislation to lock in $85 billion in spending cuts and avert a government shutdown later this month made plodding progress in Congress and the two parties advanced rival longer-term budgets in both houses.

No breakthroughs had been anticipated and none were reported in the closed-door sessions, although Obama told reporters before returning to the White House, “We’re making progress.”

In the Senate, several Republicans told the president his rhetoric was not conducive to compromise.

Sen. John Thune of South Dakota referred to a recent interview in which Obama said some Republicans want to eviscerate Social Security, Medicare and Medicaid.

“Nobody here believes those programs ought to be gutted,” Thune told Obama, the senator later recalled.

Sen. Lamar Alexander of Tennessee said the message to Obama had been: “Step one is to work with us, not just heckle and taunt us on the campaign trail, and step two is to lead.” The Tennessee lawmaker said Obama must also “go against the grain in his own party,” much as Lyndon Johnson did in winning civil-rights legislation from Congress in the 1960s or Richard Nixon did in forging an opening with China in the 1970s.

If nothing else, the reviews of Obama’s meeting with Senate Republicans were uniformly positive.

“We’ll see where we go from here, but it was a great meeting,” said GOP leader Mitch McConnell of Kentucky, who normally is one of Obama’s sharpest critics in Congress.