To begin with, we should probably take a look at good ol' Wikipedia to see what the law actually says:
If it appears from an affidavit filed by a party that the testimony of a person is material in a criminal proceeding, and if it is shown that it may become impracticable to secure the presence of the person by subpoena, a judicial officer may order the arrest of the person and treat the person in accordance with the provisions of section 3142 of this title. No material witness may be detained because of inability to comply with any condition of release if the testimony of such witness can adequately be secured by deposition, and if further detention is not necessary to prevent a failure of justice. Release of a material witness may be delayed for a reasonable period of time until the deposition of the witness can be taken pursuant to the Federal Rules of Criminal Procedure.
In the case before the court al-Kidd was arrested as he was boarding a flight to Saudi Arabia to pursue a doctorate in Religious Studies. Supposedly, the reason for his arrest and subsequent detention for 11 days in several different states was that he might have had information pertaining to a case being made against Sami Omar al-Hussayen who was being charged with providing material support to terrorists, specifically Hamas. In the end, all charges leveled against al-Hussayen were dropped though he was deported for immigration violations.
It would appear at this point that Ashcroft behaved appropriately within the confines of the statute. al-Kidd may have had information relating to an ongoing investigation. He was planning to leave the country. Seizing him in order to assure his presence at a trial as well as his availability for questioning is appropriate under the law.
But here's the thing: In the 11 days that al-Kidd was detained, never were any questions raised concerning al-Hussayen. Nor was he asked to testify against anyone. The entire purpose of the material witness statute is to ensure that someone will be available as a witness. If this isn't the purpose, than it's impossible to view it as anything other than a prolonged detention without a trial.
And that is clearly, outside of the boundaries of the law.
Which brings us naturally to Ashcroft claiming prosecutorial immunity. He claims that inasmuch as al-Kidd was imprisoned as a result of Ashcroft executing his duties as Attorney General, any claims for redress made by al-Kidd have to be voided.
I agree that immunity is an important protection for prosecutors. It would be difficult for them to do their jobs if the threat of a law suit lingered over every case. That said, I contend that there are very, very serious limits to their ability to claim the protection. Most notably, it has to be within the framework of them "doing their jobs".
In this case, it seems clear to me that Ashcroft simply was not doing his job. He perverted the purpose of the material witness law (holding onto a witness for a trial), in order to preventively detain an American citizen without proof of wrong doing. It's not his bailiwick. I would say that when he stepped beyond his duties, responsibilities and powers as authorized in this law, he stepped beyond protected action and must be held liable.