Hugh Masekela south africa
Hugh Masekela, Marcus Miller and Guillaume Perret perform on stage during the International Jazz Day 2015 Global Concert at UNESCO on April 30, 2015 in Paris, France. Kristy Sparow/Getty Images for Thelonious Monk Institute of Jazz

South African jazz musician and anti-Apartheid activist Hugh Masekela has died at the age of 78, his family have confirmed on 23 January.

In a statement his family said that after a battle with prostate cancer, the musician passed away in Johannesburg, surrounded by family.

His solo career spanned five decades and he released over 40 albums. He worked with numerous legendary artists, including Harry Belafonte, Dizzy Gillespie, The Byrds, Fela Kuti, Marvin Gaye, Herb Alpert, Paul Simon, Stevie Wonder and the late Miriam Makeba.

Born in Witbank, South Africa, in 1939, Masekela was subjected to the oppression of the Apartheid regime.

After 30 years in exile in the US, Masekela returned to South Africa in 1990 after the ANC was unbanned and Nelson Mandela was released. Masekela had written about the leader's incarceration in his 1986 anti-Apartheid anthem Bring Home Nelson Mandela.

When he was 14, Masekela received his first trumpet, according to his official website. Masekela crafted his signature Afro-Jazz sound in the late 1950s, with a notable performance in the 1959 musical King Kong, written by Todd Matshikiza. He later joined the Jazz Epistles (featuring the classic line up of Kippie Moeketsi, Abdullah Ibrahim and Jonas Gwangwa).

In 1960, aged 21, he began a 30-year exile from South Africa and arrived in New York where he joined the Manhattan School of Music. He was inspired by watching greats such as Miles Davis, John Coltrane, Thelonious Monk, Charlie Mingus and Max Roach. He received tutelage from Dizzy Gillespie and Louis Armstrong.

His debut album, released in 1963, was entitled Trumpet Africaine. Throughout the 1960s, his career soared in America, performing alongside greats such as Janis Joplin, Otis Redding, Ravi Shankar, The Who and Jimi Hendrix.

His 1968 instrumental single 'Grazin' in the Grass' went to Number One on the American pop charts and was a worldwide hit.

In October last year, Masekela issued a statement that he had been fighting prostate cancer since 2008 and would have to cancel his professional commitments to focus on his health. He said he started treatment after doctors found a "small 'speck'" on his bladder, and had surgery in March 2016 after the cancer spread.

Masekela also said he felt an "imbalance" and had an eye problem after a fall in April in Morocco in which he sprained his shoulder. He said another tumor was then discovered and he had surgery.

"I'm in a good space, as I battle this stealthy disease, and I urge all men to have regular tests to check your own condition," his statement said, asking the media for privacy.

Condolences from fans poured out Tuesday on social media paying tribute to the influential musician's career.

"A baobob tree has fallen," Nathi Mthethwa, South Africa's minister for arts and culture, wrote on Twitter. "The nation has lost a one of a kind musician . We can safely say Bra Hugh was one of the great architects of Afro-Jazz and he uplifted the soul of our nation through his timeless music."

South African President Jacob Zuma expressed his condolences, saying Masekela "kept the torch of freedom alive globally, fighting apartheid through his music and mobilizing international support for the struggle for liberation and raising awareness of the evils of apartheid ... His contribution to the struggle for liberation will never be forgotten."

Masekela inspired generations of musicians in jazz and beyond and collaborated in recent years with South African house music DJ Black Coffee and others. "I have no words," the DJ said Tuesday on Twitter.