CAPE TOWN, South Africa — Her legacy contested in death as in life, Winnie Madikizela-Mandela — an antiapartheid activist and the former wife of Nelson Mandela who was known as “the Mother of the Nation” — was honored with an official funeral in Johannesburg on Saturday.

Ms. Madikizela-Mandela, who was 81 when she died this month, was to be laid to rest after the funeral, attended by more than 40,000 mourners at Orlando Stadium in the township of Soweto. The funeral was organized by the African National Congress, the governing party that for decades strove to keep her at arm’s length.