* Angry reponse after bombing accused walked free
* N.Ireland first minister had threatened to resign
* Cameron says there has been a "dreadful mistake" (Adds first minister, detail on Northern Ireland)
By Belinda Goldsmith
LONDON, Feb 27 (Reuters) - British Prime Minister David Cameron announced on Thursday an independent inquiry into letters of immunity sent to IRA suspects after an angry response to the freeing of an Irishman accused of a 1982 bombing that killed four soldiers in London.
Cameron said an independent judge with full access to government files and officials would lead the review and report back by the end of May.
Northern Ireland's most senior politician, First Minister Peter Robinson, had threatened to resign unless there was a full inquiry into the guarantees, saying they were a "deliberate attempt to circumvent the courts".
Cameron said it was clear that there had been a "dreadful mistake" in the case of John Downey, who walked free from a London court this month because of an immunity letter.
Downey, 62, from County Donegal in Ireland, was charged with murdering four members of the Royal Household Cavalry who were killed 32 years ago when a car bomb exploded in Hyde Park as they paraded towards Buckingham Palace on July 20.
The Irish Republican Army claimed responsibility for two bombings that day, one of its most devastating attacks on the British mainland during a guerrilla campaign to drive British forces out of of Northern Ireland, but Downey denied the charges.
The IRA abandoned its armed struggle for an end to British control of Northern Ireland and unification with Ireland in the 1998 peace deal. More than 3,600 people died, including more than 1,000 members of the British security forces, during a sectarian conflict that began in the late 1960s.
Though now at peace, the province is still deeply divided between Protestants who generally want to remain part of Britain and Catholics, many of whom favour unification with Ireland, and there are sporadic outbreaks of violence.
Downey's defence argued that his trial should not go ahead because he had received a letter of assurance from the Northern Ireland Office in 2007 that he was not wanted in London in connection with the bombing.
But in fact London police had never lost interest in arresting Downey and last May they detained him at Gatwick Airport en route to Greece.
The presiding judge at the Old Bailey court ruled that the false assurance was a "catastrophic failure" that misled the defendant and ruled the trial would be an abuse of executive power.
Cameron said it was important to find out the facts.
"There was never any amnesty or guarantee of immunity for anyone and there isn't now," Cameron said. "It is right to get to the bottom of what happened." (Writing by Sam Cage; Editing by Angus MacSwan)