Wars of national liberation inspire history in a bardic register. The self-sacrificing heroism of a people in arms tends to drown out unwelcome noises off: dissidence, recalcitrance, apathy and cagey self-interest. By the same token, the humdrum – but important – underpinnings of military success are also filtered out. In his magisterial account of the Irish struggle for independence, Charles Townshend records the alarm of the Irish Republican Army in the spring of 1921 at the prevalence of nits, scabies and fungal infections among its soldiers. Orders were dispatched that company captains should stress the importance of hygiene and ensure that their men "change their socks regularly". Surely this is too much information? Do we really need to be told that heroes, too, need clean socks? I think so, yes: bathos provides an effective counterweight to legend, Townshend's deadpan command of detail easing the process by which a warrior mythology is transmuted into a realistic and humane narrative. Non-judgmental, even-handed history, it transpires, need not inhibit dramatic storytelling.

Townshend's subject is the tortuous road to Irish independence after the abortive Easter rising of 1916. Irish republicanism had been a fringe phenomenon in Irish politics before the outbreak of the first world war, and the obvious futility of the rising might have kept it on the margins had it not been for the execution of the rebellion's leaders. However, the martyrdoms of the few were to prove less significant than the general threat of conscription. In March 1918 the massive German offensive on the western front panicked the British government into introducing a military service bill for Ireland. Never mind that the chief secretary for Ireland, Henry Duke, feared that "we might as well recruit Germans". Lloyd George's coalition rushed the bill through parliament, and Duke resigned. Such was the storm the measure provoked in Ireland that it was eventually withdrawn, but not before it had worked its unintentional effect of further radicalising the Irish population. The cackhandedness of the British government fatally weakened a parliamentary Irish party committed to home rule for Ireland within the UK. The general election at the end of the war in 1918 saw Irish constituencies fall overwhelmingly to the republican separatists of Sinn Féin.

Sinn Féin was an abstentionist party whose MPs were pledged to a boycott of Westminster. Instead the party's MPs constituted themselves the Dáil Eireann, the assembly of a self-proclaimed Irish republic. Ireland now witnessed a bloody and protracted tussle between two governments – the UK and an Irish Republican "counter-state" – each of which pretended to be the legitimate authority for the whole island, and attempted to govern as much of it as was practicable.

There was no full-frontal clash of armies. Rather the war consisted of skirmishes, ambushes and assassinations. Outright violence was accompanied by the imposition of the norms of civil government – such as taxation and law courts – on a population faced with rival demands for its allegiance and its money. A willingness to see the backs of the English was far from incompatible with a grudging tightfistedness. But, happily for the Republic, as Townshend records, Michael Collins was "a finance minister with the unusual advantage of also running a death squad". Bullying coercion, or more commonly the mere implied threat of it, formed part of the dark underside of the war. There were atrocities on both sides, most notoriously by the "Black and Tans" – temporary constables recruited in large part from the ranks of veterans, and so-called from their improvised uniforms – but also by the forces of the Republic: reprisals and counter-reprisals, grim murders of non-compliant, or merely suspicious, civilians and the wanton destruction of property. The Roman Catholic bishop of Cork called it "a devil's competition".

With no decisive outcome in sight, the British parliament passed the Government of Ireland Act in 1920, which extended home rule government under the crown to two separate entities: to the six counties of Northern Ireland, which were predominantly Protestant, and to the other 26 counties of southern Ireland. While the election to the new Northern Irish parliament was seriously contested, resulting in a Unionist majority, in the south no other parties dared to stand against Sinn Féin, except in the four university seats. The impasse could only be resolved by negotiation. The result was a treaty concluded late in 1921 between the UK and the secessionist Irish Republic. In a sense the medium was the message, for the treaty was an implicit acceptance by the British of a sovereign Irish nation. Yet the terms of the treaty – which granted effective independence to the Irish Free State, though a freedom tempered by an oath of allegiance to the crown – proved divisive. Indeed, the oath was a much more controversial element of the treaty at the time than the fact of partition. Ratification of the treaty narrowly squeaked through the Dáil; but large parts of the Irish Republican Army wanted to fight on, either to secure better terms from the British or, less realistically, to realise the blue-sky dream of the Republic.

The result was a civil war in 1922-3 between the pro- and anti-treaty wings of Irish nationalism. The military advantages enjoyed by the anti-treaty forces were squandered by poor leadership and a lack of strategic vision. The pro-treaty Free State government was not only better led, but proved to be more ruthless – not least when it came to executing its opponents – than the British regime it replaced. There was also a significant element of cautious disengagement from the conflict. This was a civil war that blew hot and cold, depending on the outlook of local commanders. Townshend draws particular attention to the role of the Neutral IRA, which claimed a membership of 20,000 men who had not been actively involved in the civil war. Their appeals for peace were ignored, not least by the pro-treaty government: crushing internal resistance provided compelling proof of the new state's effective sovereignty. Eventually, the civil war spluttered to a halt, without formal closure. As Townshend remarks, there were "no negotiations, no truce terms: the Republic simply melted back into the realms of the imagination".

Townshend argues convincingly that many Republicans who yearned for an independent Ireland remained vague about its form of government and even about the degree of separation from Britain. Arthur Griffith, Sinn Féin's founder and the chief negotiator of the treaty, favoured a kind of dual monarchy for Britain and Ireland on the model of the post-1867 Austro-Hungarian empire. There were, of course, simon-pure Republicans, for whom the uncorrupted ideal of an ethereal Republic trumped the reality of practical self-government under the treaty; but there were still uncertainties about the full implications of republicanism. On the continent republicanism was widely associated with anticlericalism and free-thinking. In Ireland too it could be traced back to the late Enlightenment Protestant radicalism of Theobald Wolfe Tone and the United Irishmen of Belfast, but by the early 20th century it had become effectively – if not officially – sectarian. The Catholic hierarchy, nevertheless, still frowned on republicanism as a font of heresy.

An appreciation of such ironies and unexpected disjunctions disturbs the smooth unreflective flow of traditional prejudice. As Ireland, north and south, enters a decade of combustible centenaries, Townshend's magnificent, unflinching history of the fight for independence holds out the prospect – however slim it might sometimes seem – for truth and reconciliation.