White House press secretary Sarah Huckabee Sanders outside the White House in Washington. Picture: Evan Vucci/AP

New York - White House Press Secretary Sarah Huckabee Sanders tried to pay tribute to Martin Luther King Jr, but it didn't work out so well.

"Today we honor a great American who gave his life to right the wrong of racial inequality," she tweeted. "Our country is better thanks to his inspiration and sacrifice."

Twitter users were quick to lash out at Sanders, blaming the administration she serves for not following his example and pointing out that King, who was murdered, had his life taken from him.

Professor and award-winning former New York Daily News columnist Karen Hunter accused Sanders of bringing "dishonor" to King's legacy by promoting Trump administration policies she called "diametrically opposed" to the civil rights leader's vision.

Other Twitter users likened Sanders's family, which includes former Arkansas governor Mike Huckabee, to conservative politicians who fought against civil rights in King's day. One user photoshopped "Make America Great Again" baseball caps onto a white mob in the 1960s that was photographed harassing a black man in a diner.

Author and Forward.com columnist Molly Jong-Fast blamed Sanders's boss for allegedly "sowing division."

"He didn't give his life. He was murdered," wrote one Twitter user. King, who would have turned 90 this month, was shot dead outside a Memphis, Tennessee, hotel room in 1968. He was 39.