Martin McGuinness, a former Irish Republican Army commander and Sinn Fein political leader who helped negotiate peace in Northern Ireland after decades of sectarian violence, and became a senior official in its power-sharing government, died on Tuesday in Derry. He was 66.

In bombings and killings that raged from the 1960s to the ’90s between Protestant and Roman Catholic forces — the Troubles that left 3,700 dead — Mr. McGuinness was widely believed to have joined, and later directed, terrorist activities. He denied the allegations. His only convictions, in the early ’70s, were for possessing explosives and ammunition and for belonging to the outlawed I.R.A.

Image

Mr. McGuinness, left, helping a wounded man after a funeral in Belfast for three I.R.A. members came under attack in 1988.CreditDavid Jones/Press Association, via Associated Press

But in his 40s he evolved into a peacemaker and politician. He was chief negotiator for Sinn Fein, the political arm of the I.R.A., in a complex Good Friday Agreement in 1998, in which Britain, Ireland and the political parties of Northern Ireland created a framework for power-sharing in Belfast and for eventual resolution of issues like sovereignty, civil rights, disarmament, justice and policing.

And on May 8, 2007, a day many thought would never come, the Rev. Ian Paisley, who had founded the Democratic Unionist Party and had long stood for continued Ulster association with Britain, and Mr. McGuinness, who had fought for Ulster’s incorporation into a united Ireland, took oaths as the leader and deputy leader, respectively, of Northern Ireland’s power-sharing government.

As Prime Ministers Tony Blair of Britain and Bertie Ahern of Ireland looked on, the proceedings ended direct British control of Northern Ireland and reinstated home rule for its 1.8 million people. Legislative power was vested in a Northern Ireland Assembly, and Ulster began a new era in which long-bitter adversaries pledged to abandon armed struggles and embrace political solutions.

The I.R.A. had already destroyed its weapons and given up its clandestine cells, and Sinn Fein (pronounced shin-FAIN) had endorsed a reconstituted Ulster police force, which it had regarded for decades as an arm of British and Protestant repression.

Left unresolved was whether Northern Ireland would ever be reunited with the predominantly Catholic Irish Republic. The Good Friday Agreement provided that that could happen only with the consent of Northern Ireland, and it made it likely that Ulster and its Protestant majority would remain in perpetuity — along with the legacies of killings and religious enmities.

Once banned from entering Britain, Mr. McGuinness won a seat in the House of Commons in London; ran unsuccessfully for the presidency of Ireland in 2011; visited prime ministers several times at 10 Downing Street; met Presidents Bill Clinton, George W. Bush and Barack Obama at the White House; and shook hands twice with Queen Elizabeth II.

“This is the side of his political life that McGuinness wants the Irish people to remember: the reformed man, the young, hotheaded idealist who learned the error of his ways and forged peace, an achievement that still wins him plaudits from around the world,” the British magazine New Statesman said in 2011. “To some in Ireland he is a hero — a man who stood up for the oppressed, who fought the British. To others, he was, is and will always be a criminal.”

James Martin Pacelli McGuinness was born in Derry, Northern Ireland, on May 23, 1950, one of seven children of William and Peggy McGuinness, a Catholic family that shared two bedrooms and an outdoor toilet in the crowded slum of Bogside, a setting for much violence during the Troubles. His father worked in an iron foundry, and his mother in a shirt factory. The parents attended Mass and took communion daily, and they gathered their six sons and daughter nightly for a recitation of the rosary.

Martin was a bright, eager boy who loved the poems of W. B. Yeats and played chess, but he failed the 11 Plus exams in his last year in grade school. So instead of getting an academic education, he went to a Christian Brothers technical school, where the boys were beaten. He quit school at 15 and became a butcher’s assistant. Like many Bogside youths, he joined the lionized I.R.A. and was a gunman at 18.

In the late 1960s and early ’70s, Bogside was a war zone of hatred and revenge. Stone-throwing youths were beaten by the Royal Ulster Constabulary. There were riots and protests. Two boys were shot dead by British soldiers in 1971. The Provisional I.R.A., the more militant successor to the I.R.A., launched ferocious counterattacks. Arson fires burned 100 shops, and snipers killed 26 British soldiers in Derry alone in 1971 and ’72.

Mr. McGuinness was second in command of the Derry I.R.A. on Bloody Sunday, the grim day in 1972 when British troops fired on unarmed civilians staging a peaceful protest against the British practice of internment without trials. Fourteen people were killed in what became known as the Bogside Massacre.

In 1973 and 1974, Mr. McGuinness was imprisoned twice, for possession of a car filled with explosives and ammunition, and for his acknowledged membership in the illegal I.R.A.

Image

Martin McGuinness in 2014. He helped end years of violence in Northern Ireland.CreditCathal McNaughton/Reuters

In 1974, he married Bernadette Canning. They had four children: daughters Grainne and Fionnuala, and sons Fiachra and Emmet. There was no immediate word on his survivors.

From the late 1970s to the mid-’80s, Mr. McGuinness was widely assumed to be the I.R.A.’s chief of staff. Hundreds of people were killed by the I.R.A. in that period, including the queen’s cousin Earl Mountbatten, whose fishing boat exploded off County Sligo in 1979. Many I.R.A. attacks also occurred in England, including a bombing at a Brighton hotel in 1984 that killed five people and was intended to assassinate Prime Minister Margaret Thatcher and her cabinet.

Mr. McGuinness was accused of participating in or plotting crimes. Television documentaries and news and magazine articles linked him to murders of informers and bombings that killed scores. He and Gerry Adams, Sinn Fein’s president, reportedly concluded in the early 1990s that militance was not advancing their aims. Cease-fires in 1994 and 1997 ensued, and talks led to the peace accords.

Mr. McGuinness was minister of education in an interim government from 1999 to 2002. Elected to the House of Commons in London in 1997, he was re-elected in 2001, 2005 and 2010 and served until 2013. A biography, “Martin McGuinness: From Guns to Government,” by Liam Clarke and Kathryn Johnston, appeared in 2001.

As senior officials of Northern Ireland, he and Mr. Paisley became friends of sorts. When Mr. Paisley retired in 2008, Mr. McGuinness gave him a Seamus Heaney poem. After a decade as deputy first minister, Mr. McGuinness resigned in January for health reasons, prompting a snap election in which Sinn Fein made major gains and nearly overtook the Democratic Unionists as the largest party in the regional assembly.

An earlier version of this obituary misstated one of Mr. McGuinness’s accomplishments. While he won a seat in the House of Commons in London, he did not take the seat, in line with Sinn Fein’s policy of abstaining as a form of protest.

A version of this article appears in print on , on Page A24 of the New York edition with the headline: Martin McGuinness, I.R.A. Leader Turned Politician, Dies at 66. Order Reprints | Today’s Paper | Subscribe