Obituary: Martin McGuinness
Martin McGuinness was the IRA leader who became a peace negotiator - a committed Irish republican who ended up shaking hands with the Queen.
Together with Gerry Adams, he was the main republican architect of the move towards a political solution to Northern Ireland's problems.
His life followed an extraordinary trajectory between violence and politics, moving from being a senior commander in the IRA to helping broker talks that eventually led to the peace negotiations of the 1990s.
Eventually, he became Northern Ireland's deputy first minister, forging an unlikely alliance with Ian Paisley, the DUP leader who was the fiercest - and loudest - critic of the republican movement.
They developed such a rapport in their years in government that they became poster boys for modern politics, earning the nickname The Chuckle Brothers.
James Martin Pacelli McGuinness was born into a large family living in the deprived Bogside area of Londonderry on 23 May 1950. His unusual third name was a tribute to Pope Pius XII.
He attended Derry's St Eugene's Primary School and, having failed the 11-plus exam, he went to the Christian Brothers technical college, known locally as Brow o' the Hill.
He did not enjoy his time at college and his failure to qualify for grammar school rankled.
"It is my opinion," he later said, "that no education system has the right to tell any child at the age of 10 and 11 that it's a failure."
He was working as a butcher's assistant when Northern Ireland's Troubles erupted in the late 1960s. Angry about the rough handling of protesters demanding civil rights for Catholics, McGuinness was quickly drawn into the ranks of the IRA.
By January 1972, when soldiers from the Parachute Regiment killed 14 people in his hometown on what became known as Bloody Sunday, McGuinness was second in command of the IRA in the city.
The Saville Inquiry concluded he had probably been armed with a sub-machine-gun on the day, but had not done anything that would have justified the soldiers opening fire.
In April 1972, BBC reporter Tom Mangold walked with McGuinness through the "no-go area" then known as Free Derry.
Mangold described McGuinness as the officer commanding the IRA in the city and asked if the organisation might stop its bombing campaign in response to public demand.
The 21-year-old McGuinness made no attempt to contradict the reporter, explaining that the IRA "will always take into consideration the feelings of the people of Derry and those feelings will be passed on to our general headquarters in Dublin".
Together with Gerry Adams, Martin McGuinness was part of an IRA delegation that held unsuccessful talks with the British government in London in July 1972.
The following year he was convicted of IRA activity by the Republic of Ireland's Special Criminal Court after being caught near a car containing explosives and nearly 5,000 rounds of ammunition.
Security chiefs were in no doubt that he was a key figure in the IRA as it reorganised and rearmed in the 1980s.
Chief of staff
Among its most high-profile attacks was the attempt to kill Prime Minister Margaret Thatcher at the Grand Hotel in Brighton in 1984.
Thatcher wanted to starve the IRA of what she called the "oxygen of publicity", so was furious when the BBC broadcast a Real Lives documentary in 1985 featuring McGuinness, who was unashamed of his reputation.
Driving a car through the Bogside, he told the documentary makers that reports suggesting he was chief of staff of the IRA were untrue, "but I regard them as a compliment".
He was later accused of having advance knowledge of the 1987 Enniskillen Remembrance day bombing - something he denied.
The mother of an alleged IRA informer claimed McGuinness had played a role in luring her son home to his death.
He was also thought to have approved proxy bombings, such as the murder of army cook Patsy Gillespie, in which hostages were forced to drive car bombs which were then detonated before they could get away.
But behind the scenes, Martin McGuinness engaged in secret contacts with British agents which laid the groundwork for the IRA ceasefires and peace negotiations of the 1990s.
When the Good Friday Agreement led to the creation of a devolved government at Stormont, he became education minister. One of his first acts was to abolish the 11-plus examination which he had failed many years before.
Devolution proved an on-off affair, but in 2007 the hardline Democratic Unionists were persuaded to share power with Sinn Féin.
The public witnessed the almost unbelievable sight of Martin McGuinness forging not just a political partnership, but what looked like a genuine friendship with one of his erstwhile enemies, the DUP leader Ian Paisley.
"Ian Paisley and I never had a conversation about anything - not even about the weather," he said in 2007.
"And now we have worked very closely together over the last seven months and there's been no angry words between us.
"This shows we are set for a new course."
His relationships with Ian Paisley's successors appeared cooler.
But as dissident Irish republicans tried to derail the peace project, the now deputy first minister denounced them as "traitors to the island of Ireland". He left no doubt that he believed violence could no longer serve a purpose, declaring: "My war is over."
Martin McGuinness failed in his bid to become Irish head of state in the presidential election of 2011.
But he later struck up an apparent rapport with the British head of state, shaking hands with the Queen on more than one occasion.
In 2012, he announced he was standing down as the Member of Parliament for mid-Ulster although, in common with other Sinn Féin MPs, he had never taken his seat at Westminster.
He unexpectedly quit his post as deputy first minister in January 2017 following a row over a botched scheme, overseen by then First Minister Arlene Foster, to provide renewable energy for Northern Irish households which could end up costing the taxpayer £500m.
Ill health was also a factor in his decision to stand down. When he arrived at Stormont to hand in his resignation, he looked visibly frail.
He told the BBC it was "a big decision" and he would not stand for re-election.
"The honest answer is that I am not physically capable or able to fight this election, so I will not be a candidate," he said.
His resignation triggered an election in Northern Ireland as, under the peace agreement, the executive cannot function if one side walks out. In the event, the 2 March poll saw Sinn Féin making gains that ended the unionist majority in Stormont.
Martin McGuinness married Bernadette Canning in 1972 and the couple had four children. Away from politics he enjoyed Gaelic football and hurling, both of which he had played in his younger days.
He was also keen on fly-fishing and cricket.
As an IRA leader, there is no doubt Martin McGuinness was hated and feared. But as a peacemaker, he possessed a personal charisma that he used to win over at least some of those who had viewed him with suspicion.
Moreover, his reputation as a hard man gave him the authority among Irish republicans to deliver major concessions, such as IRA disarmament and acceptance of a reformed police service.