Former President Barack Obama has urged Americans to “stand up to hate” at a time when the political landscape is deeply divided.

“Everywhere we see the refuge of falling into tribe and clan and anger at those who don’t look like us, or have the same surnames, or pray the way we do,” he told an audience as he accepted an award from the late President John F Kennedy’s family.

Mr Obama did not make partisan attacks or mention his successor, President Donald Trump, who has often criticised the previous administration and has worked to undo a number of the Democrat's initiatives

Donald Trump savours 'repeal of Obamacare' after winning House vote

“At such moments courage is necessary," Mr Obama said on accepting the Profile in Courage Award. "At such moments we need courage to stand up to hate. Not just in others, but in ourselves.

“At such moments we need the courage to stand up to dogma. Not just in others, but in ourselves.”

The award recognises displays of courage similar to those described in Mr Kennedy’s book Profiles in Courage, which is given in recognition of individuals risking their careers or lives acting according to their conscience.

Caroline Kennedy, the daughter of Mr Kennedy, who presented Mr Obama with the award, said: “Today, when many doubt the integrity of our elected leaders, this award is more important than ever.”

Mr Obama also used the speech to make his first public comments since leaving office on the push to repeal his signature health care plan, imploring members of Congress on Sunday to demonstrate political courage even if it rails against their party's positions.

The former president recalled members of Congress who voted to pass the Affordable Care Act during his presidency, only to lose their seat in later elections.

“They had a chance to insure millions,” he said. “But this vote could also cost them their seats, perhaps end their political careers.”

Mr Obama made no direct reference to Thursday's House vote to dismantle much of the health care law, but said that while it did not take courage to help the rich and powerful, it does require courage to help the sick and vulnerable.

“It is my fervent hope and the hope of millions ... such courage is still possible, 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,” said Mr Obama, whose appeal seemed to focus on wavering Republicans.

Arizona Senator Jeff Flake, one of the few Republicans to attend the dinner, told reporters the Senate would write its own version of the legislation and he did not expect the House bill to survive intact.

The former President focused much of his address on the legacy of President Kennedy, as the library prepared to mark the 100th anniversary of his birth later this month. Mr Obama noted the Kennedys had long advocated for health care reform, and in particular, the late Senator Edward Kennedy, who died of brain cancer before passage of the Affordable Care Act.

Barack Obama's best moments in the White House Show all 11 1 /11 Barack Obama's best moments in the White House Barack Obama's best moments in the White House May 19, 2009 “The President was leaving the State Floor after an event and found Sasha in the elevator ready to head upstairs to the private residence. He decided to ride upstairs with her before returning to the Oval Office,” Peter Souza Barack Obama's best moments in the White House Oct. 26, 2012 President Barack Obama pretends to be caught in Spider-Man's web as he greets the son of a White House staffer in the Outer Oval Office Peter Souza Barack Obama's best moments in the White House “A National Security staffer, Carlton Philadelphia, brought his family to the Oval Office for a farewell photo with President Obama. Carlton’s son, Jacob, softly told the President he had just gotten a haircut like President Obama, and asked if he could feel the President’s head to see if it felt the same as his.” Peter Souza Barack Obama's best moments in the White House March 21, 2010 The President, Vice President and senior staff applaud after watching on television the House vote on H.R. 4872 for health care reform, in the Roosevelt Room of the White House Peter Souza Barack Obama's best moments in the White House Dec. 3, 2009 President Barack Obama fist-bumps custodian Lawrence Lipscomb in the Eisenhower Executive Office Building following the opening session of the White House Forum on Jobs and Economic Growth Peter Souza Barack Obama's best moments in the White House Sept. 22, 2015 "The Obama family and Biden family greet Pope Francis as he arrives in the United States for the first time at Joint Base Andrews," Sept. 22, 2015. Peter Souza Barack Obama's best moments in the White House Feb. 21, 2014 President Barack Obama and Vice President Joe Biden participate in a "Let's Move!" video taping on the Colonnade of the White House, Feb. 21, 2014 Peter Souza Barack Obama's best moments in the White House Feb. 18, 2016 President Barack Obama watches First Lady Michelle Obama dance with 106-Year-Old Virginia McLaurin in the Blue Room of the White House prior to a reception celebrating African American History Month, Feb. 18, 2016 Peter Souza Barack Obama's best moments in the White House Jan. 21, 2013 "The President and First Lady wave to supporters as they ride in the inaugural parade. I had asked the President if I could ride in the presidential limousine and the President joked, 'But Michelle and I were planning to make out," Jan. 21, 2013. Peter Souza Barack Obama's best moments in the White House Barack Obama and former First Lady Michelle Obama share a private moment in a freight elevator at an Inaugural Ball, January 2009 all pics: Pete Souza Barack Obama's best moments in the White House Barack Obama rests his hand on the bible that President Lincoln used for his swear-in, being held by his wife Michelle Obama as he is sworn in as the 44th President of the United States of America Rex

Among the guests who made their way down the red carpet into the library for the event were representatives of the Kennedy family, members of Congress, former Obama staffers and celebrities including former late-night talk show host David Letterman. Former Vice President Joe Biden and former Secretary of State John Kerry also were in attendance.

US Rep. Joe Kennedy III, a Massachusetts Democrat, 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 Mr Kennedy, a harsh critic of the Republican health overhaul plan.

Mr Obama travels to Italy this week to give a keynote address on climate change and food security at Tuesday's Seeds and Chips Global Food Innovation Summit in Milan.