JOHANNESBURG — Nelson Mandela’s ex-wife Winnie Madikizela-Mandela, an anti-apartheid activist in her own right whose reputation was sullied by scandal, has died. She was 81.

The woman many South Africans have described as the “Mother of the Nation” and a champion of the black majority, died “surrounded by her family and loved ones,” according to a statement released by Madikizela-Mandela’s family.

Madikizela-Mandela was the second of Nelson Mandela’s three wives, married to him from 1958 to 1996.

Mandela, who died in 2013, was imprisoned throughout most of their marriage, and Madikizela-Mandela’s own activism against white minority rule led to her being jailed for months and placed under house arrest for years.

“She kept the memory of her imprisoned husband Nelson Mandela alive during his years on Robben Island and helped give the struggle for justice in South Africa one of its most recognizable faces,” the family said.

However, Madikizela-Mandela’s political activism was marred by her conviction in 1991 for kidnapping and assault, for which she was fined.

She faced these allegations again during the 1997 hearings before the Truth and Reconciliation Commission, a panel that investigated apartheid-era crimes.

As a parliamentarian after South Africa’s first all-race elections, she was convicted of fraud. Still, Madikizela-Mandela remained a venerated figure in the ruling African National Congress, which has led South Africa since the end of apartheid in 1994.

She continued to tell the party “exactly what is wrong and what is right at any time,” said senior ANC leader Gwede Mantashe.

The ANC, which was the main movement against apartheid, had lost popularity in recent years in part because of scandals linked to former President Jacob Zuma, who resigned in February.

Zuma’s successor, President Cyril Ramaphosa, described Madikizela-Mandela in a televised tribute as a “champion of justice and equality” and a “voice for the voiceless.”

Nobel laureate and former archbishop Desmond Tutu, a periodic critic of the ruling party, noted her passing by describing Madikizela-Mandela as “a defining symbol” of the fight against apartheid.

“She refused to be bowed by the imprisonment of her husband, the perpetual harassment of her family by security forces, detentions, bannings and banishment,” Tutu said. “Her courageous defiance was deeply inspirational to me, and to generations of activists.”

Madikizela-Mandela had been in and out of hospital since the start of the year, according to her family. She had back surgery a year ago.

After hearing of her death, some people gathered Monday evening outside Madikizela-Mandela’s home in the Soweto area of Johannesburg to sing tributes. She had attended Easter services in Soweto over the long weekend.

Nomzamo Winifred Zanyiwe Madikizela was born in a remote swath of South Africa called Pondoland on Sept. 26, 1936.

The young Winnie grew up in what is now Eastern Cape province and came to Johannesburg as the city’s first black female social worker.

Her research into the high infant mortality rate in a black township, which she linked to poverty caused by racism, first sparked her interest in politics.

In 1957, she met Nelson Mandela, an up-and-coming lawyer and anti-apartheid activist 18 years her senior, and they married a year later.

The first five turbulent years of their marriage saw Mandela going underground to build the armed struggle against apartheid, and finally to prison in 1963, while his wife gave birth to two daughters.

The couple divorced in 1996, two years after Mandela became president in South Africa’s first all-race elections, with Mandela accusing his wife of infidelity.

As the mother of two of Mandela’s children, Madikizela-Mandela and her ex-husband appeared to rebuild a friendship in his final years.

After Mandela’s death, however, she became involved in disputes over his inheritance.

The Washington Post contributed.