Graca Machel sleeps in a room not far from the ailing Nelson Mandela’s sickroom. She has rarely left the hospital since he was admitted last month, emerging this week to make an appearance at the Nelson Mandela Center of Memory in Johannesburg. In a short statement, his wife of nearly 15 years reassured the world that the beloved anti-apartheid icon is not in constant pain.

“Although Madiba sometimes may be uncomfortable, very few times he is in pain,” Machel said, referring to Mandela by his clan name. “I think the best gift which he has given this nation again is the gift of unity.”

Her own unique story — as a trained guerrilla, advocate for children and the only woman to have served as first lady of two African nations — has become intertwined with that of Mandela.

Since they married on his 80th birthday in 1998, Machel (pronounced mah-SHELL), who is now 67, has been his constant companion and an equal advocate of the causes that he champions.

“She has not only brought joy to Madiba, she has also tried very hard to draw the Mandela family together,” retired archbishop Desmond Tutu said in an e-mail.

Tutu has accused other members of the Mandela family of acting out of turn. A court this week got involved in a family dispute over where three of Mandela’s children are buried, which is connected to where Mandela has said he wants to be buried. Other relatives have filed lawsuits over Mandela’s assets. “It’s almost like spitting in Madiba’s face,” Tutu said in a statement decrying the discord.

Machel, who wears her hair in a short Afro and has an easygoing demeanor, has stood apart from the family feud spilling into headlines. Since marrying Mandela in the final year of his presidency, she has deftly dealt with the complicated familial and political situation, observers said.

“She has great warmth, and like Nelson Mandela, she insists on dignity,” said Verne S. Harris, director of research and archives at the Mandela center, where Machel is known as “Mum.” “She has an identity and a life journey independent of Nelson Mandela.”

South Africans and Mandela supporters worldwide had been deeply invested in his 38-year marriage to Winnie Madikizela-Mandela, who carried on the fight against apartheid while Nelson Mandela was imprisoned for 27 years.

When Nelson and Winnie’s marriage fell apart — first with a separation in 1992, then an ugly divorce in 1996 — his love life became tabloid fodder that turned on his description of their marriage as cold.

He and Machel married in a private ceremony two years after his divorce. At the outset, Machel was not universally accepted by South Africans as a suitable match for their president, in part because she is from the neighboring country of Mozambique.

“She wasn’t pushy about being the new Mrs. Mandela. She didn’t flaunt it, and she showed a lot of respect for the feelings of people in South Africa. She was patient and went about her life with him,” said Charlayne Hunter-Gault, a former foreign correspondent based in Johannesburg. “She seems to have understood where she fit into that whole complicated” scheme of things.

Machel brought credentials of her own as she approached South Africa’s political royal family with both an embrace and a steady sense of independence. She kept the name Machel to honor her first husband, Samora Machel, who led Mozambique to independence from Portugal in 1975 and became its first president. Samora Machel, who was an ally of Mandela’s African National Congress, was killed in a 1986 plane crash deemed suspicious by Mozambicans who believed apartheid-era officials were responsible.

Before becoming first lady of Mozambique, Machel was a freedom fighter, having trained as a guerilla in Mozambique’s war for independence. (In that training, she learned to take apart and reassemble an assault rifle.) It was during that war that she met her first husband, with whom she had two children.

Machel also has a law degree, speaks three languages and served as minister of education and culture in Mozambique for a decade, boosting the number of children enrolled in school.

She and Mandela began their acquaintance when he sent a note of condolence after her husband’s death, according to news reports. After Mandela was released from prison in 1990, they were in the same place on several occasions and developed a friendship.

Throughout their courtship and since, Machel continued her work as a children’s advocate. In 1996, she authored a United Nations report titled “The Impact of Armed Conflict on Children,” which argued that “more and more of the world is being sucked into a desolate moral vacuum. This is a space devoid of the most basic human values; a space in which children are slaughtered, raped and maimed; a space in which children are exploited as soldiers.”

She is also a member of the Elders, a group of global leaders who work for peace. In 2007, she traveled to Darfur along with Tutu, former president Jimmy Carter and others. While the men were off to the side, Sudanese women described to Machel the horror of being raped on the way to fetch water, Hunter-Gault recalled.

“The women seemed to just take some solace in the fact that there was this strong, powerful woman listening,” she said.

It is that spirit that has made Machel “a mother not only of her children, but of many other children of the continent,” said Sello Hatang, chief executive of the Mandela center. “Her passion and activism for children’s rights, especially girl children, makes her a mother to many who are still oppressed in some corner of the world.”

In a 1998 interview with The Washington Post, Machel described her connection with Mandela as a “really delightful story.”

“Both of us went through very painful experiences. We met each other. We enjoy this relationship with such fulfillment and such plenitude. . . . It’s so sweet and so complete and so natural,” she said. “We don’t take it for granted. We know what it is to be without. We say to each other, at last we are very lucky people because we could have ended up without being able to share this experience.”