As the world's thoughts turn towards Nelson Mandela, it is becoming clear that his wife too will take her place in history as a huge figure in the fight against poverty, illiteracy and injustice

Shakespeare, in one of Nelson Mandela's favourite lines, now strangely apposite, says that "the valiant never taste of death but once". As the world waits for Mandela to make his final rendezvous with history, one woman – his third wife – who has been at his bedside throughout his illness, and now keeps vigil there, is almost perfectly cast for her role. Graça Machel (pronounced Mah-shell) has, after all, been here before.

In 1986, Machel was tragically widowed when the Russian Tupolev jet carrying her husband, Samora Machel, the first president of independent Mozambique, ploughed into a remote hillside just inside the South African border. The apartheid regime denied involvement, but suspicions of a political assassination linger. As the nation rallied in grief, Graça Machel, a young mother, was dubbed Mozambique's Jackie Kennedy. It's not an implausible comparison. She has the same easy, cosmopolitan self-confidence, natural presence, and command of languages (English, Portuguese and French).

She has many weighty qualifications, too, including a law degree – combined with an impressive slate of global achievements in women's rights and humanitarian issues. "I'm not Samora's wife," she's been known to snap. "I'm me." In public, she's beloved for her ready smiles and self-deprecating humour, mixed with a steely determination. As Mozambique's first lady, she was widely credited with being a moderating influence over her firebrand Marxist husband.

And if Samora Machel's story is now part of African liberation folklore, and if Nelson Mandela is a figure for the ages, Graça Machel is close to the equal of her two husbands. Shy of publicity, she once said: "It's not two leaders who fell in love with me, but two real people. I feel privileged that I have shared my life with two such exceptional men."

She was born Graça Simbine on 17 October 1945 on the coast of Mozambique, then a Portuguese colony. Her family were peasants. Her father, who was semi-literate, provided for the family by oscillating between the South African mines and farming, and would become a Methodist minister. When he died, weeks before Graça was born, family legend says that he made his wife promise that their unborn child would have proper schooling. Machel's mother kept her word. "We were a poor family," Machel has said, "but I had the best education."

When young Graça Simbine got a scholarship to high school in the capital, Maputo, she was the only black African in a class of 40 whites. Now her education as an African radical began. "Why is it," she said to herself, "that I'm made to feel strange in my own country? They're the foreigners, not me. Something is wrong here."

Machel remains formidably committed to asking awkward questions about the status quo, and following her own agenda.

In the beginning, like Mandela, she was an African freedom fighter with a mission to liberate, and educate, her people. After a spell in Portugal, Graça Simbine joined Frelimo (the Front for the Liberation of Mozambique) as a courier, was trained as a guerrilla fighter (she can still strip an assault rifle) and met the movement's charismatic leader, Samora Machel. The couple became lovers during the revolutionary war, and married in August 1975, two months after Mozambique gained independence. Kenneth Kaunda, Zambia's first president, came to the wedding. Not for the last time, Graça Simbine, now Machel, found her life linked to a moment of history.

It was said that the union was as much a political partnership as a romance. When her husband became president, his new wife became minister of culture and education. Graça Machel now showed her true colours. Mozambique had one of the highest illiteracy rates in Africa. Within two years, she had boosted school attendance and lowered illiteracy. But any euphoria she might have felt was soon dashed by new crises. A CIA-backed counter-revolutionary movement (Renamo) plunged the new nation into civil war, causing chaos and wrecking the economy. Then – just as peace was being established – Samora Machel was killed in that mysterious plane crash. Graça was devastated. Pictures of the funeral show her bowed over her husband's casket, stricken with grief.

Winnie Mandela and her still-imprisoned husband wrote letters of condolence. To Nelson, Graça Machel replied, movingly: "From within your vast prison, you brought a ray of light in my hour of darkness." Solace was fleeting. For five years, Machel wore black. Finally, in 1991, prompted by her 12-year-old son, Machel started anew, launching a foundation to address poverty.

Once again, she demonstrated extraordinary gifts of leadership and imagination. In 1995, she won the UN's important Nansen medal for her work on childrens' rights in refugee camps. "Graça Machel is impressive," says the author of the book that inspired the movie Invictus, the Observer's John Carlin. "She has a different level of intelligence, clarity and charisma."

When, in 1996, she was urged to run for secretary general of the UN (a job that went to Kofi Annan), she declined with the strategic savvy characteristic of an ex-freedom fighter. "There is no political will," she said of the UN. "So what would I do there?" Besides, she had a new, even more demanding, role to explore. Machel was on the path to becoming Mandela's third wife.

Their first meeting had come, after his release from prison in 1990, at a very low point in the life of the ANC leader. "We were both very, very lonely," Machel has said. "We both wanted someone you could talk to, someone who'd understand." In private, Mandela was broken. His wife, Winnie, refusing him any marital relationship, had humiliated him in public during their celebrity divorce.

Once Mandela's marriage was over, Machel says: "We started to see each other more often." Their first significant public appearance was at the grave of Samora Machel. By 1996, rumours of a relationship had been confirmed: paparazzi shots of here a shy kiss, there some sheepish hand-holding. The president's office declared Machel to be Mandela's "official companion".

When she could be persuaded to say anything, the new "official companion" displayed her old romantic sang-froid. She told a Portuguese newspaper that, as with her first husband: "Nelson and I were together some time before love came. It wasn't love at first sight. No, with me, things don't happen like that."

Second chances: Nelson Mandela and his new wife, Graça Machel, on board the QE2 in 1998. Photograph: Louise Gubb/Corbis

There was no doubt who was playing hard to get. Machel remains devoted to Mozambique. They were living in separate cities, an hour's flight apart, and the president was telephoning twice a day.

Mandela, now eager to remarry, even enlisted the support of Archbishop Desmond Tutu, who got himself into trouble with South Africa's feminists by saying that the president needed "someone to give him his slippers". When Machel finally agreed to marry the president on his 80th birthday (he is 27 years her senior), she said: "It took a very special person to change my mind." Winnie, meanwhile, raged ineffectually against the emotional cunning of the woman she called "that concubine".

It is a belated love match between two people who occupy a quite extraordinary place in contemporary Africa. Mandela has been the first to acknowledge Machel's role in the autumn of his life. "She is the boss," he said in 2007. "When I am alone, I am weak." For her part, Machel bats away any sentimental idealisation of her man. "People may say my husband is a saint," she told one English newspaper, "but … to me, he is just a human being who is simple and gentle. I wasn't prepared for Madiba (his clan name) coming into my life, but now we make sure we spend time with each other because we were so lonely before. You only live once."

Graça Machel knows what it means to be unique. She is the only woman to have been first lady to two separate presidents. Not since Eleanor of Aquitaine became first the queen of France, then queen of England, married to Henry II, has one woman occupied such a position. Her love story has a Shakespearean dimension. As Mandela's widow she will become an icon of South African sorrow, and an impressive mother-figure to a nation in mourning. Like her beloved Madiba, Graça Machel now stands in the antechamber of history, with yet another extraordinary future role almost the only sensible prediction.

• Comments will be turned on later this morning