Tony Blair's target for removing failed asylum seekers helped cause last year's foreign prisoner crisis, an official report has revealed.
Budget cuts had created a backlog of prisoners facing deportation, it said.
But when 27 extra staff were finally hired they were allowed to work only on removing asylum seekers.
This meant other offenders, often guilty of more serious crimes, continued to be freed without being considered for deportation.
In total 1,013 foreign nationals were freed without being assessed for deportation - a crisis that led to the sacking of then Home Secretary Charles Clarke.
Fifteen out of 189 serious offenders mistakenly released are still at large.
They include one of the "most serious" offenders, which includes murderers and rapists, and 14 "serious" offenders.
A further four "serious" offenders - including one child sex offender - had been caught, but were subsequently bailed by the Asylum and Immigrations tribunal and have also gone missing.
The report, by the Border and Immigration Agency, is the first official admission the "tipping point" asylum target - removing more failed asylum claimants than new unfounded applicants - diverted attention from removing foreign prisoners.
At the end of 2003/4 the team in charge of deportation cases had 5,000 cases to deal with and just 40 staff.
The report said the unit had to prioritise failed asylum seekers, early removals and other measures to reduce prison numbers, which "diverted resources" from dealing with more serious offenders.
It said there had been an agreement to expand the Criminal Casework Team (CCT) team dealing with identifying and considering foreign prisoners for deportation in 2002, but this was overturned after a "financial crisis early in 2003, followed by a recruitment and budgetary freeze".
This, the report says, was the result of the Comprehensive Spending Review imposing a freeze on Home Office funding.
"When new resources became available in April 2004 they were not enough to keep pace with the rapidly growing caseload," it said.
"By the beginning of 2005," the report says, "caseworkers were starting most cases only shortly before release, and the number of cases who were released without any consideration multiplied.
"The systems for tracking cases were weak and the extent of this failure went unrecognised."
The report also catalogues a series of management errors at the enforcement and removals department within the Immigration and Nationality Directorate (IND), with three senior members of staff in summer 2004 not aware of how "critical the situation had been a year earlier".
"It was not clear whether the deputy head reported on his areas of responsibility direct to the senior director, or did so through the head of enforcement and removals.
"This ambiguity became apparent only after the crisis," the report says.
It also describes a complex filing system - with 13 different lockable cupboards for different categories of files - which often led to them being lost and "time wasted searching for them".
And it blames a Home Office initiative to improve the speed of response to ministers' letters from MPs for diverting resources from processing serious cases.
But it also reveals that considering foreign prisoners for deportation had not been seen as a priority for the IND before 2003.
And management had been too slow to respond to a growing caseload and public concern despite it being raised a number of times at various levels of the Home Office.
By the time the National Audit Office and Commons Public Accounts Committee had begun to take an interest in the issue in 2005, "the reputational risks of under-resourcing had become more apparent," says the report.
"The crisis revealed a gulf between public expectations that all serious foreign prisoners would be considered for deportation, and the reality that for many years only a small fraction of cases were referred to IND and considered by them.
"To meet these expectations eventually required a more than twenty-fold increase in resources over the level of four years earlier," it concludes.
But the report also says that where only one in four foreign nationals in Britain's prisons were ever identified, now all were tracked and, if necessary, deported.
"In one sense the problems which arose were problems of success, due to the much better identification of foreign prisoners as a result of the work of the CCT support team in liaising with prisons," it says.
It says IND has now brought in a new system "which provides a fuller opportunity for new risks to be identified and escalated".
The foreign prisoner revelations led to the sacking by Tony Blair of Charles Clarke as home secretary in 2006.
Current Home Secretary John Reid said within days of taking over that the immigration department was "not fit for purpose" and has since revamped it and handed over a range of the Home Office's functions to the new Ministry of Justice.