775 F.2d 1037
In the Matter of the Petition of Carl HILL for Writ ofHabeas Corpus.Carl Basil Angelo HILL, Petitioner,andJeff T. Appleman, William O. Dillingham, and National GayRights Advocates, Applicants-Appellants,v.UNITED STATES IMMIGRATION AND NATURALIZATION SERVICE, andthe United States, and their agents, etc.,Respondents-Appellees.
No. 84-2503.
United States Court of Appeals,Ninth Circuit.
Argued and Submitted Sept. 13, 1985.Decided Nov. 1, 1985.

Suzanne E. Engelberg, Mill Valley, Cal., Keith W. Lewis, William F. Murphy, Dillingham & Murphy, San Francisco, Cal., for petitioner.
William Kanter, Irene M. Solet, Attys., Appellate Staff, Washington, D.C., for respondents-appellees.
Appeal from the United States District Court for the Northern District of California.
Before MERRILL, HUG, and SCHROEDER, Circuit Judges.
HUG, Circuit Judge:
Appellants appeal from the district court's order denying them attorneys' fees under the Equal Access to Justice Act ("EAJA"), 28 U.S.C. Secs. 2412(b) and 2412(d).  We affirm.

FACTS

1
The factual background of the administrative and court litigation in this matter is set forth in Hill v. Immigration and Naturalization Service, 714 F.2d 1470 (9th Cir.1983), aff'g Lesbian/Gay Freedom Day Committee, 541 F.Supp. 569 (N.D.Cal.1982).  A brief restatement follows.


2
The Immigration and Nationality Act (the "Act") provides that certain classes of aliens shall be ineligible to receive visas and shall be excluded from admission into the United States.  8 U.S.C. Sec. 1182(a) (1982).  Section 1182(a)(4) of the Act describes as an excludable disability a "psychopathic personality, or sexual deviation, or a mental defect."    The predecessor to that subsection has been interpreted to include homosexuals.   Boutilier v. Immigration and Naturalization Service, 387 U.S. 118, 87 S.Ct. 1563, 18 L.Ed.2d 661 (1967);  Hill, 714 F.2d at 1472 n. 1.


3
Prior to 1979, the Immigration and Naturalization Service ("INS") would refer aliens who were suspected of being homosexuals, and who were seeking admission into the United States, to a Public Health Service ("PHS") officer for a medical examination, just as it would process any applicant suspected of a mental or physical defect.  If the PHS official determined that the applicant was a homosexual, a certificate of that finding would be forwarded to the INS.  8 U.S.C. Sec. 1224 (1982).  The certificate constituted the evidentiary basis for exclusion.  8 U.S.C. Sec. 1226 (1982).


4
In August 1979, the Surgeon General announced that the PHS would no longer certify homosexuality per se as a mental disease or defect, and that homosexuality was not determinable through a medical diagnostic procedure.  The Surgeon General's change in policy was based on the medical community's changing views toward homosexuality.  Prior to 1973, homosexuality was classified as a mental disease or defect by the American Psychiatric Association ("APA").  In 1973, however, the APA deleted "homosexual" from its Diagnostic and Statistical Manual;  homosexuality was no longer considered a mental defect.    See Hill, 741 F.2d at 1472-73 n. 3.


5
The INS responded to the new PHS policy by allowing suspected homosexuals to enter the country conditionally under parole status until the controversy could be resolved.  On the advice of the Office of Legal Counsel of the Department of Justice that enforcement of the Act's exclusionary provision against homosexuals was required even in the absence of PHS certificates, the INS adopted new procedures in September, 1980 for the exclusion of homosexual aliens.  Under the new guidelines, entering aliens were not to be asked any questions concerning their sexual preferences.  If, however, an alien made a voluntary, unambiguous statement that he is a homosexual, or if a third party voluntarily stated that an entering alien is a homosexual, the alien was subject to further examination and would be requested to sign a written statement that he is a homosexual.  Based on his oral or written admissions, an alien would be referred to an immigration judge for an exclusion proceeding.   Id. at 1473.


6
On November 5, 1980, Hill presented himself for admission as a nonimmigrant visitor for pleasure.  Hill's unsolicited statement that he was a homosexual resulted in his referral for exclusion proceedings.  At the exclusion hearing, the immigration judge ("IJ") held that Hill could not be excluded, despite his admissions, because the INS could not produce any medical certificate that Hill was afflicted with a sexual deviation or mental defect, as was statutorily required.  On appeal to the Board of Immigration Appeals, the IJ's order was reversed on the ground that an alien who admits homosexuality fails to carry his burden of establishing admissibility under the Act.


7
Hill filed a petition for a writ of habeas corpus in the district court, challenging his exclusion.  The district court granted the writ, holding that exclusion of an alien under 8 U.S.C. Sec. 1182(a)(4) must be based on a medical certificate.   Lesbian/Gay Freedom Day Committee, 541 F.Supp. at 580.  This court affirmed.   Hill, 714 F.2d at 1480.


8
Appellants filed a motion for attorneys' fees, arguing that they were entitled to fees under 28 U.S.C. Sec. 2412(b) because the litigation had conferred a substantial benefit on an ascertainable class, and under 28 U.S.C. Sec. 2412(d) because the Government's position was not substantially justified.  The district court denied the motion.  This appeal ensued.

STANDARD OF REVIEW

9
A district court's decision to award or deny attorneys' fees under the EAJA will be reversed only for an abuse of discretion.   Timms v. United States, 742 F.2d 489, 492 (9th Cir.1984);  United States v. First National Bank of Circle, 732 F.2d 1444, 1446 (9th Cir.1984).  There is an abuse of discretion when a judge's decision is based on an erroneous conclusion of law or when the record contains no evidence on which he rationally could have based that decision.   Premium Service Corp. v. Sperry & Hutchinson Co., 511 F.2d 225, 229 (9th Cir.1975).  The district court's interpretation of the EAJA is a question of law subject to de novo review.   Foster v. Tourtellotte, 704 F.2d 1109, 1111 (9th Cir.1983).

DISCUSSION

10
A. Award of attorneys' fees in a habeas corpus proceeding.


11
Relying on the Second Circuit's decision in Boudin v. Thomas, 732 F.2d 1107, reh'g denied, 737 F.2d 261 (2nd Cir.1984), the Government claims that the EAJA has no application to the instant request for attorneys' fees.  Both provisions of the EAJA upon which appellants base their request for attorneys' fees apply to civil actions brought by or against the United States.1   Although the EAJA does not define the term "civil action," the Boudin court determined that the structure and purpose of that legislation indicate that Congress did not contemplate an award of attorneys' fees in habeas corpus proceedings.   Boudin v. Thomas, 732 F.2d at 1112.


12
In Boudin, a prisoner filed suit challenging the conditions of her confinement.  Her complaint was styled as a verified petition for a writ of habeas corpus.  The prisoner was eventually transferred to another institution before fully litigating her complaint.  The prisoner sought attorneys' fees under the EAJA.  Although the court spoke broadly of habeas corpus proceedings, it is apparent that the court was concerned with habeas corpus proceedings in the criminal context.


13
The denial of attorneys' fees in Boudin was premised on the court's understanding of the dual purposes of the EAJA:  to remove the financial disincentive for individuals and small businesses challenging or defending against government regulatory conduct where the cost of attorneys may be prohibitive, and to encourage challenges to improper government action as a means of helping to formulate better public policy.  The Boudin court held that those interests were not served in the prisoner's habeas corpus proceedings in that case.  The court stated:


14
By contrast, habeas petitions are dedicated to vindicating individual rights based on the Constitution rather than refining rules and policy.  They are no more public policy oriented than is a criminal trial [for which EAJA fees are clearly unavailable].  Moreover, we doubt that Congress felt a need to encourage the filing of habeas petitions;  they flourished long before the [EAJA] was proposed.


15
Id. at 1114.


16
As the Boudin court noted, we must look to the substance of the remedy sought, not the labels attached to the claim, in determining whether a proceeding falls within the term "any civil action" of the EAJA.  In contrast to the challenge of unlawful criminal custody in Boudin, Hill sought to gain admission into this country and, in essence, sought to secure a declaratory judgment that the Government's policy of excluding homosexual aliens without a medical certificate was improper.  Hill's claim was not merely a vindication of his own personal rights, but a challenge to a regulatory policy that had a sweeping effect on homosexual aliens seeking to enter the United States.


17
Moreover, the dual purposes underpinning the EAJA are served by characterizing this particular proceeding as a civil action.  Hill, a nonresident alien, was not eligible for government-provided counsel, see 8 U.S.C. Sec. 1362 (1982) and, as an alien seeking to visit, had little economic incentive to challenge such action.  And, unlike the inmate in Boudin, a nonresident alien who is a homosexual has no custodial incentive to reverse the Government's action.  Application of the EAJA to Hill's petition is appropriate.

B. Section 2412(b)

18
Subsection (b) permits a court to award fees and costs against the Government to the same extent that the court may award them in actions between other parties.  Such an award may be based on common law or statutory grounds.  28 U.S.C. Sec. 2412(b).  Appellants argue that the district court abused its discretion in denying them attorneys' fees under the equitable common fund or common benefit doctrine.


19
To qualify for an award under the doctrine, the prevailing party must either impart a substantial nonmonetary benefit or create or preserve a common fund for an identifiable class of beneficiaries.   Southeast Legal Defense Group v. Adams, 657 F.2d 1118, 1122 (9th Cir.1981).  The successful litigant, whose efforts must result in the creation of a monetary fund in which others will share, or otherwise confer a substantial benefit on an ascertainable class, is then entitled to recover attorneys' fees from the benefitted class.  The common fund or common benefit doctrine is limited to those instances when (1) the class of beneficiaries is sufficiently identifiable, (2) the benefits can be accurately traced, and (3) the fee can be shifted with some exactitude to those benefitting.   Id. at 1122-23 (quoting Alyeska Pipeline Service Co. v. Wilderness Society, 421 U.S. 240, 265 n. 39, 95 S.Ct. 1612, 1625-26 n. 39, 44 L.Ed.2d 141 (1975).


20
Here, the substantial nonmonetary benefit purportedly resulting from the appellants' action is conferred on homosexual aliens seeking to enter or remain in the United States.  Appellants seek to recover their attorneys' fees not from the homosexual aliens, the direct beneficiaries of their efforts, but from the Government.  However, the Government derives absolutely no benefit from the outcome of the litigation.  The purpose of the common fund/common benefit doctrine--to spread the litigation costs proportionately among the beneficiaries--would not be served by imposing an award of attorneys' fees against the Government.  Additionally, an award of fees and costs is improper because the alleged benefit is not conferred on a sufficiently identifiable class and is not easily traced.   See Southeast Legal Defense Group, 657 F.2d at 1123 (plaintiffs who blocked construction of a highway, benefitting all state taxpayers by preserving public funds, were not permitted to recover attorneys' fees because it was impossible to determine how much members benefitted);  McQuiston v. Marsh, 707 F.2d 1082, 1085 (9th Cir.1983) (request for attorneys' fees denied because alleged benefit had not been conferred on an identifiable class but upon the citizenry as a whole).


21
Appellants also argue that a common fund will be created, and the Government will therefore benefit, through the payment of visa and application fees to the Government by homosexual aliens who are no longer excludable.  This argument fails because the common fund theory does not apply when the general citizenry or taxpayers constitute the class of beneficiaries.   Southeast Legal Defense Group, 657 F.2d at 1123;  McQuiston, 707 F.2d at 1085.  Furthermore, it is speculative that the increased revenue from such fees would exceed the additional costs of processing the applications.

C. Section 2412(d)(1)(A)

22
Section 2412(d)(1)(A) authorizes an award of attorneys' fees against the United States Government unless the district court finds that the position of the Government is substantially justified or that special circumstances make the award unjust.  The district court determined that the Government's position was substantially justified and denied the motion for attorneys' fees under section 2412(d)(1)(A).


23
In reviewing the Government's position, we consider the totality of the circumstances present prior to and during litigation.   Timms, 742 F.2d at 492.  The test of substantial justification is one of reasonableness.  The Government has the burden to show that its case had a reasonable basis both in law and in fact.  Id.  It may sustain that burden by showing its position is "a novel but credible extension or interpretation of the law."   Hoang Ha v. Schweiker, 707 F.2d 1104, 1106 (9th Cir.1983);  see Foster, 704 F.2d at 1112-13.  That the Government lost does not raise a presumption that its position was not substantially justified.   First National Bank of Circle, 732 F.2d at 1447.  The Government need not show that it had a substantial likelihood of prevailing.  Id.


24
Here, the Government posited a colorable interpretation of the statutes governing exclusion of aliens.  The INS was confronted with a serious dilemma when the Surgeon General announced its new policy regarding homosexuality.  The Supreme Court had held in Boutilier that homosexuality was included within the definition of a "psychopathic personality."    Whether a medical certificate was not required was an open question upon which reasonable arguments could be made.  In fact, the Fifth Circuit in Matter of Longstaff, 716 F.2d 1439 (5th Cir.1983), cert. denied, --- U.S. ----, 104 S.Ct. 2668, 81 L.Ed.2d 373 (1984), upheld the INS's denial of naturalization to an alien who admittedly was a homosexual at the time of his admission to the United States.  The Fifth Circuit's approval of the INS's policy to exclude homosexual aliens on the basis of the alien's unambiguous admission supports the district court's finding that the Government's position was substantially justified.

CONCLUSION

25
The district court's denial of appellants' motion for attorneys' fees is affirmed.


26
AFFIRMED.



1
 28 U.S.C. Sec. 2412(b) states in part:
Unless expressly prohibited by statute, a court may award reasonable fees and expenses of attorneys, in addition to the costs which may be awarded pursuant to subsection (a), to the prevailing party in any civil action brought by or against the United States or any agency and any official of the United States acting in his or her official capacity in any court having jurisdiction of such action.
28 U.S.C. Sec. 2412(d)(1)(A) states that:
Except as otherwise specifically provided by statute, a court shall award to a prevailing party other than the United States fees and other expenses, in addition to any costs awarded pursuant to subsection (a), incurred by that party in any civil action (other than cases sounding in tort) brought by or against the United States in any court having jurisdiction of that action, unless the court finds that the position of the United States was substantially justified or that special circumstances make an award unjust.


