Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

Americans must have the courage to "stand up to hate" during a time of polarization, former President Barack Obama said Sunday night in accepting an award from the late President John F. Kennedy's family.

"For many Americans, I know that this feels like an uncertain and perilous time," Obama — accompanied by his wife, Michelle Obama, and former Vice President Joe Biden — said in accepting the annual Profile in Courage award at the John F. Kennedy Presidential Library and Museum in Boston.

"Our politics remains filled with division and discord," Obama said just days after House Republicans won passage of a bill that would dismantle much of his signature health care law.

Obama has made few public appearances since leaving office in January, and he didn't mention his Republican successor, Donald Trump, by name in his remarks. But there was little doubt whom he was referring to.

The Morning Rundown Get a head start on the morning's top stories. This site is protected by recaptcha

"At such moments, courage is necessary," he said. "At such moments, we need courage to stand up to hate, not just in others, but in ourselves. At such moments, we need courage to stand up to dogma, not just in others, but in ourselves. ...

"Courage means not doing what is simply politically expedient but doing what [people] believe in their hearts is right," he said. "And this kind of courage is required of all of us."

Former President Barack Obama receives the 2017 John F. Kennedy Profile in Courage Award at the John F. Kennedy Library in Boston on Sunday. C.J. Gunther / EPA

Caroline Kennedy, Kennedy's daughter, who presented Obama with the award, said, "Today, when many doubt the integrity of our elected leaders, this award is more important than ever."

Jack Schlossberg, the late president's grandson, introduced Obama, saying: "Without President Obama, I might still be sitting on my couch eating Doritos and watching sports."

The award is named for a 1957 Pulitzer Prize-winning book by John F. Kennedy that profiled eight U.S. senators who risked their careers by taking principled though unpopular positions. May 29 would have been his 100th birthday.

Among the long line of guests who made their way down the red carpet into the library for the event were members of the Kennedy family, members of Congress, former Obama staffers and celebrities, including David Letterman.

Rep. Joe Kennedy III, D-Massachusetts, said Obama earned the award by meeting many challenges that faced him during his presidency.

"It's about understanding the challenges we face as a country and as a planet and mustering the political will to do what is right, even if what is right at that moment isn't necessarily popular," said Kennedy, a harsh critic of the Republican health care overhaul plan.

In selecting him for the award, the John F. Kennedy Library Foundation lauded Obama for expanding health security to millions of Americans, which opponents of the bill passed Thursday by the House argued could be lost if it becomes law. The bill faces an uncertain future in the Senate.

Obama isn't the first president to receive the award. He joins Republicans Gerald Ford and George H.W. Bush.