
695 P.2d 440 (1985)
107 Idaho 1055
In the Matter of the Application of Ford Jack ROBISON, Petitioner, For a Writ of Habeas Corpus.
Ford Jack ROBISON, Petitioner-Appellant,
v.
STATE of Idaho, DEPARTMENT OF HEALTH AND WELFARE, Respondent.
STATE of Idaho, Plaintiff-Respondent,
v.
Ford Jack ROBISON, Defendant-Appellant.
Nos. 14970, 15148.
Court of Appeals of Idaho.
February 5, 1985.
*441 Luvern Charles Johnson, III, Pocatello, for Ford Jack Robison.
Jim Jones, Atty. Gen., Lynn E. Thomas, Sol. Gen., James F. Wickham, Deputy Atty. Gen., Boise, for State.
Before HUNTLEY, Acting C.J., and McFADDEN and OLIVER, Acting JJ., Special Panel.
OLIVER, Acting Judge.
While the two cases before us were not consolidated on appeal, since they both arose from the same set of facts, they were consolidated for purpose of oral argument and will be disposed of by this single opinion.

FACTS IN CASE NO. 15148
Ford Jack Robison was charged with reckless driving in the Magistrate Division of the Seventh Judicial District for Madison County on July 21, 1982. The following day, without speaking to an attorney, without waiving the right to counsel and without counsel having been appointed, Robison entered a plea of guilty to the offense charged. The sentencing court sentenced Robison to a fine of $100, with all but $25.00 suspended, and five days in jail together with six months probation. (The formal judgment makes no reference to the probation period although both the transcript of the hearing of July 22 and the magistrate's log/minutes set out the probation requirement.) Apparently thereafter on October 6, 1982, the deputy prosecuting attorney for Madison County filed a "Motion for Review of Sentence" whereby the State sought "to present evidence as to defendant's mental state, and possibilities of treatment... ." (A copy of this motion is not contained in the record before this Court, but there is no dispute that such was made). On October 11, 1982, a hearing was had on this motion and a formal order was issued October 13, 1982. This order specifically represented that appellant "was present without counsel." The order provided that Robison's probationary period be extended an additional six months with provision for review and possible additional extension; that Robison be committed to the Department of Health & Welfare until July 22, 1983, with recommendation that he be placed "at Blackfoot for evaluation, treatment and counseling until such time as the Department of Health and Welfare prescribes other treatment." Thereafter, on December 8, 1982, after Motion to Amend Order filed by the administrator of State Hospital South, an Amended Order was issued ex parte without the presence of Robison or appointed counsel, by the terms of which Robison was required to voluntarily commit himself to State Hospital South and undergo such treatment at such facilities recommended by the Department or be in violation of the conditions of his probation. Robison appealed this order to the district court. After Habeas Corpus proceedings were unsuccessful in companion case herein No. 14970, the parties (Robison now being represented by counsel) stipulated that at the initial stages of the proceeding below Robison was not represented by counsel and pursuant to the stipulation the Court, on April 11, 1983, ordered that "... any and all orders in the proceedings below ... are hereby vacated, reversed, cancelled and held to be of no legal force and effect... ."
Subsequently, Robison's counsel petitioned for attorney fees, which were denied. This denial is the sole issue on appeal in case No. 15148. The order appealed from is affirmed.

FACTS IN CASE NO. 14970
On December 28, 1982, Robison, while at State Hospital South filed a Petition for Writ of Habeas Corpus, his petition reciting substantially the facts related above in Case No. 15148. The district court quashed the writ, ruling that Robison's commitment to the hospital was voluntary and he could therefore be released at any time at his own request. The Court further *442 ruled that Robison's remedy to declare his conviction void for lack of counsel was by appeal from the alleged void order of the magistrate, not by habeas corpus.
On appeal from the denial of the Writ of Habeas Corpus Robison asserts the following issues:
A. Was appellant denied the fundamental right to counsel?
B. Did the District Court err in quashing the Writ?
C. Is appellant entitled to an award of attorney fees?

RULING IN CASE NO. 15148
In Case No. 15148 Robison seeks attorney fees pursuant to I.C. § 12-121, § 12-120, I.R.C.P. 54(e)(1) and 42 U.S.C.A. § 1988 (1981).
Awards of attorney fees are not limited under 42 U.S.C.A. § 1988 only to cases pursued in federal court. Thiboutot v. Maine, 405 A.2d 230, affirmed 448 U.S. 1, 100 S.Ct. 2502, 65 L.Ed.2d 555 (Me. 1979). Attorney fees may be recovered in a criminal action where the expenditure is a foreseeable result of acts of the defendant. Kerr v. City of Chicago, 424 F.2d 1134 cert. denied, 400 U.S. 833, 91 S.Ct. 66, 27 L.Ed.2d 64 (7th Cir., 1970). However, attorney fees under 42 U.S.C.A. § 1988 are awarded "to enforce a provision of 1981, 1982, 1983, 1985 and 1986 of this title." When a party has not pled a claim pursuant to one of those provisions, there is no basis on which to award attorney fees. Robison's counsel claimed attorney fees pursuant to 28 U.S.C.A. § 1985 (sic) for the first time in his memorandum of costs submitted some five weeks after the district court vacated Robison's case. A claim under the federal civil action statutes, 42 U.S.C.A. §§ 1983-88 was neither pled nor claimed during the proceedings before the magistrate and district courts. Therefore, appellant's claim for attorney fees pursuant to those statutes cannot be maintained.
As to Robison's claim for attorney fees based on I.C. sections 12-120 and 12-121, and I.R.C.P. Rule 54(e)(1), I.C. § 12-120 and § 12-121 apply to civil actions. Robison's case was a criminal action, to which those statutes do not apply. I.R.C.P. Rule 54(e)(1) creates no independent right to attorney fees, but merely establishes a framework for applying I.C. § 12-121. Therefore the claim for fees under the Idaho Code and rule was inappropriate.

RULING IN CASE NO. 14970
In Case No. 14970 we conclude that the stipulation and order vacating and cancelling the proceedings in Case No. 15148 render the ruling on habeas corpus and the appeal from that ruling moot and thus the appeal to this Court is dismissed.
However, for future guidance we feel it necessary to comment on some issues raised by the appeal.
Robison, pursuant to the order of December 8, 1982, "voluntarily" committed himself to State Hospital South. We hold, contrary to the holding of the district court, that such commitment sufficiently deprived appellant of his liberty to allow him to challenge the December 8, 1982 order by way of habeas corpus. Appellant had only two options available to him  "voluntarily" commit himself, or face incarceration for violation of a condition of his probation. Clearly, appellant was sufficiently restrained of his liberty to allow him to test the legality of his commitment by way of habeas corpus.
We further hold that under the circumstances herein, appeal from illegal orders of the sentencing magistrate is not the exclusive remedy afforded Robison. The essence of habeas corpus is an attack upon the legality of a person's detention for the purpose of securing release where custody is illegal. The writ was developed as an extraordinary remedy where correctional actions are inadequate. The writ is an avenue by which relief can be sought where detention of an individual is in violation of a fundamental right. A person who is committed pursuant to an order which is allegedly void is entitled to proceed by habeas corpus. In re Downing, Harrison *443 and Perry, 103 Idaho 689, 652 P.2d 193 (1982); Bounds v. Smith, 430 U.S. 817, 97 S.Ct. 1491, 52 L.Ed.2d 72 (1977); Preiser v. Rodriguez, 411 U.S. 475, 93 S.Ct. 1827, 36 L.Ed.2d 439 (1973).
The writ herein was directed to George Bachik, Administrative Director of State Hospital South. By way of Return to Writ, Mr. Bachik stated that Robison was admitted to the hospital as a voluntary patient; that he had not requested release, but should he make such request, he would be released. Robison did not file an Answer to the Return as required by I.C. § 19-4212. By failing to do so appellant did not controvert or deny the material facts set forth in the return. Robison could not simply rely upon the allegations in his petition for the writ, unless such allegations were adopted or reiterated in an Answer to Return, or as in common practice, the petition is by stipulation and order deemed and treated as the answer to the return. Unless one of the above avenues is pursued the issues are not formed. Cole v. Cole, 68 Idaho 561, 201 P.2d 98. Neither procedure was followed in the instant case.
We express concern with the manner in which the State and the trial court conducted the proceedings in Case No. 15148 without providing appellant with even minimal procedural safeguards.
Mr. Johnson, appellant's counsel herein, has not been successful in his request for attorney's fees on these appeals. Nevertheless, we wish to compliment him for the exemplary services he has performed on a pro bono basis on behalf of indigent clients, not only in the present cases but also in other cases of which we take notice.
No costs or attorney fees.
HUNTLEY, Acting C.J., and McFADDEN, Acting J., concur.
