Martin McGuinness, who began as a terrorist and ended up as deputy first minister in Northern Ireland's power-sharing government, died peacefully in hospital on Monday aged 66. His career spanned almost five decades in that troubled place -- and by resigning from the power-sharing government in January, he began a new and possibly final act in that long-running drama.

If it is the last act in the Northern Irish tragedy, leading to some form of "joint sovereignty" over Northern Ireland by the United Kingdom and the Irish Republic, then there may be more blood spilled before the end. That would not have bothered McGuinness.

As a Roman Catholic born in Derry, McGuinness grew up believing that Britain must be driven out of Ireland and that the Protestant majority in Northern Ireland must be forced to accept unification with the Irish Republic. But the burning issue when he was a young man was the oppression of Northern Irish Catholics by the Protestant majority.

The initial Catholic protests in the mid-1960s were non-violent, but McGuinness (aged 21) was already the second-in-command of the Provisional Irish Republican Army in Derry at the time of Bloody Sunday in 1972, when 14 civil rights protesters were killed by British soldiers.

The Provisional IRA exploited atrocities like that to convert the Catholics' non-violent struggle for civil rights into a guerrilla war employing terrorist tactics and aiming for unification with Ireland. McGuinness was one of the foremost advocates of violence, and quickly rose to become the IRA's chief of staff.

He claimed to leave the IRA in 1974 to enter politics, but local observers agree he remained a senior IRA member at least to the late 1980s.

In all, the IRA killed 1,781 people during the period when McGuinness was a senior commander, including 644 civilians, and McGuinness was probably involved in the decision-making on half of those attacks. Fintan O'Toole, a columnist in the Irish Times, recently called him a "mass killer."

But if so, he was a pragmatic mass killer. When it became clear in the 1990s that the campaign of violence was not delivering the results McGuinness had hoped for, he was open to peaceful compromise. He played a key role in persuading most of the more dedicated IRA killers to accept the power-sharing government embodied in the 1998 Good Friday Agreement.

As the leader of Sinn Fein, the IRA's political wing, in Northern Ireland, McGuinness became the deputy first minister of the province, sharing power with the biggest Protestant party, the Democratic Unionist Party (DUP). He was seen as a calm, constructive politician -- but he never lost sight of his ultimate goal.

When he resigned in January, he knew he was dying. And Arlene Foster, leader of the DUP, was entangled in an energy scandal.

McGuinness was also well aware that Britain's decision to leave the European Union in last June's referendum created new possibilities.

The open border between Northern Ireland and the Irish Republic depends on both countries being part of the EU. When Britain leaves it will likely become a "hard" border that controls the movement of goods and people. That would greatly anger the Catholic of Northern Ireland, and if Sinn Fein goes on refusing to appoint a deputy prime minister then no new power-sharing regime is possible.

But there is no sign that either Sinn Fein or the DUP will budge, and Britain may have to re-impose "direct rule" on Northern Ireland.

Solving the border issue could lead to outcomes the IRA and Sinn Fein would welcome -- like joint British-Irish sovereignty over Northern Ireland. A little violence could help to stimulate that kind of thinking.