Former President Barack Obama said Sunday that Democratic lawmakers who voted for the Affordable Care Act knowing it might cost them their seats did the right thing even if it meant the end of their political career.

Speaking at the John F. Kennedy Presidential Library in Boston, where he was awarded the Profiles in Courage Award, Obama said a lot of freshman Democratic lawmakers found themselves tossed into the healthcare debate when they arrived in Washington. Though they knew voting for Obama's healthcare bill might be unpopular back home, Obama said they felt it was the right thing to do.

"They had a chance to insure millions … but then this same vote would likely cost them their new seats, perhaps end their political careers," he said. "And, these men and women did the right thing. They did the hard thing.

"Theirs was a profile in courage. Because of that vote, 20 million people got health insurance that didn't have it," he added.

Obama seemed to direct a message to centrist Republican lawmakers, especially those in the Senate, who are now on the fence about whether to back the GOP effort to repeal and replace the Affordable Care Act.

Obama said the debate goes on and lawmakers need to be courageous in order to do the right thing for Americans.

"It is my fervent hope and the hope of millions that, regardless of party, such courage is still possible," he said. "That today's members of Congress, regardless of party, are willing to look at the facts and speak the truth, even when it contradicts party positions."

Obama also implied criticism of votes by House Republicans to pass the American Health Care Act on Thursday because that bill would cut nearly a billion dollars from Medicaid while cutting taxes on the wealthy.

"I hope that current members of Congress recall that it actually doesn't' take a lot of courage to aide those who are already powerful," he said. "But it does require some courage to champion the vulnerable, and the sick and the infirm, and those who often have no access to the corridors of power."