US comedian and civil rights activist Dick Gregory - who broke racial barriers in the 1960s and used his fame to counter racism and protested wars in Vietnam and the Middle East - has died aged 84.

Gregory died at a hospital in Washington, DC, late on Saturday after being hospitalised for a week following a bacterial infection, his family said on social media.

One of the first black stand-up comedians to find success with white audiences, Gregory rose from an impoverished childhood in St Louis to become a celebrated satirist who deftly commented on racial divisions at the dawn of the US civil rights movement.

His comedic style would pave the way for, and heavily influence, comedians such as Bill Cosby, Eddie Murphy, Chris Rock and Dave Chapelle.

A close friend of Martin Luther King Jr, Malcolm X, and Muhammad Ali, Gregory was in the vanguard of the struggle for racial equality in the 1960s and championed integration.

An admirer of Gandhi, he embraced non-violence and in 1967 fasted for 22 days in opposition to the war in Vietnam.

He would later hold long fasts and would go without solid food for weeks to draw attention to a wide range of causes, including Middle East peace, police brutality, the Equal Rights Amendment for women, and animal rights - actions that would hurt his comedy career.

Commenting on his opposition to the political establishment, Richard Pryor said in a 2004 interview with the Independent newspaper: "Dick Gregory was the greatest, and he was the first. Somebody had to break down that door."

Gregory would later begin to preach about the transformative powers of prayer and good health and helped John Lennon withdraw from opiates and alcohol use.

In the late 1980s, he developed and distributed products for the popular Slim-Safe Bahamian Diet and when diagnosed with lymphoma in 2000, he fought it with herbs, exercise and vitamins. The disease went into remission a few years later.

Tributes poured in on social media on Sunday with politicians, comics, and activists praising the iconic performer's civil rights efforts.

Democratic Senator Cory Booker tweeted: "Dick Gregory's unflinching honesty and courage, inspired us to fight, live, laugh and love despite it all. #RestinPower."

"He provoked us to think and to change," wrote the King Center.

He provoked us to think and to change. And he made us laugh, too. Rest, our dear elder, #DickGregory. pic.twitter.com/LxSgYMhI8K — The King Center (@TheKingCenter) August 20, 2017

Civil rights activist Jesse Jackson said: "He taught us how to laugh. He taught us how to fight. He taught us how to live. Dick Gregory was committed to justice. I miss him already."

He taught us how to laugh. He taught us how to fight.He taught us how to live.Dick Gregory was committed to justice.I miss him already. #RIP pic.twitter.com/3CfpM2O17D — Rev Jesse Jackson Sr (@RevJJackson) August 20, 2017

Dean Obeidallah, an American comedian of Palestinian descent, wrote: "RIP dick Gregory. A comedian who inspired me and other comedians to use our platform to fight the power.

RIP dick Gregory. A comedian who inspired me and other comedians to use our platform to fight the power — (((DeanObeidallah))) (@Deanofcomedy) August 20, 2017

Meanwhile, civil rights activist and academic Maya Wiley used a Gregory quote mocking racists and white supremacists following the introduction of a stamp commemorating the life of Martin Luther King Jr.

"I am really enjoying the new MLK Jr stamp - just think about all those white bigots, licking the backside of a black man," wrote Wiley.