OPINION OF THE COURT
This is an appeal by John E. Washington, a social security disability claimant, who became a “prevailing party” against the United States within the meaning of the Equal Access to Justice Act (“EAJA”), 28 U.S.C. § 2412(d)(1)(A) (1982) (repealed 1984), when the district court reversed an adverse decision of the Secretary of Health and Human Services (the “Secretary”) and directed an award of benefits.1 Wash*961ington was unsuccessful, however, in obtaining an award of counsel fees under the EAJA because the district court decided that the position taken by the Secretary both in the agency and in the district court was substantially justified. There are no disputed facts before us and the sole question for review is whether, on the administrative record, the Secretary has met her burden of showing substantial justification for her agency and litigation positions. We conclude that, in such circumstances, our scope of review is plenary. We also conclude that the position of the Secretary was not substantially justified; hence we will reverse and remand for an award of attorney’s fees.
I.
The law applicable to a determination of entitlement to EAJA attorney’s fees has been oft-repeated and may be succinctly stated. A party is entitled to attorney’s fees “unless the court finds that the position of the United States was substantially justified.” 28 U.S.C. 2412(d)(1)(A) (1982). The position of the United States includes not only its litigation position but also the agency position that made the lawsuit necessary. Natural Resources Defense Council v. EPA, 703 F.2d 700, 708 (3d Cir.1983); Dougherty v. Lehman, 711 F.2d 555, 563 n. 12 (3d Cir.1983). Substantial justification “constitute[s] a middle ground between an automatic award of fees to a prevailing party and an award made only when the government’s position was frivolous.” Dougherty, 711 F.2d at 563. See also Natural Resources Defense Council, Inc. v. EPA, 703 F.2d at 708, 711 (opinion announcing the judgment of the court); id. at 714-15 (concurring opinion); id. at 719 (concurring and dissenting opinion). The burden of proving substantial justification is on the government. Dougherty, 711 F.2d at 561. To meet its burden, the government must show: (1) a reasonable basis in truth for the facts alleged; (2) a reasonable basis in law for the theory it propounds; and (3) a reasonable connection between the facts alleged and the legal theory advanced. Citizens Council of Delaware County v. Brinegar, 741 F.2d 584, 593 (3d Cir.1984); Dougherty, 711 F.2d at 564. The government’s burden of showing substantial justification is a strong one and is not met merely because the government adduces “some evidence” in support of its position. Tressler v. Heckler, 748 F.2d 146, 150 (3d Cir.1984).
The case law has not prescribed a comprehensive formula for determining what constitutes a reasonable basis in law. As Dougherty makes clear, there is no per se rule that imposes counsel fees on the government when it loses merely because its legal theory is rejected.2 Dougherty, 711 F.2d at 566. If, for example, the case turns on an unsettled or “close question of law,” id., the government usually will be *962able to establish that its legal theory was “reasonable,” even if it was not ultimately accepted as a legal rule by the courts. When the government’s legal position clearly offends established precedent, however, its position cannot be said to be “substantially justified.”
II.
As yet, few courts of appeals have devoted detailed consideration to the scope of review of district court determinations of substantial justification. The most comprehensive discussion thus far appears in Spencer v. NLRB, 712 F.2d 539, 561-65 (D.C.Cir.1983). The Spencer court, noting the lack of guidance in the statute itself as to the proper standard and the dearth of legislative history on this point, sought insight from both the general principles governing appellate review of district court judgments in civil nonjury eases and the objectives underlying the EAJA. Id. at 563.
A.
Disposing first of basic propositions, the Spencer court concluded, as has this court, see In re Fine Paper Antitrust Litigation, 751 F.2d 562, 584 (3d Cir.1984), that any findings of fact made by a trial judge in the course of ruling on a petition for attorney’s fees are subject to review under the “clearly erroneous” standard of Fed.R.Civ.P. 52(a);3 that the judge’s conclusions on questions of law are subject to plenary review; and that determinations deriving from the application of legal standards to the facts of the case are also subject to plenary review. We agree with Spencer on these points.
Turning to the more difficult question, and that relevant here, the Spencer court held that determinations of whether a particular interpretation of the law is plausible or colorable were to be regarded as conclusions of law and reviewed as such. In support of this holding, Judge Edwards stated:
It would appear that, if anything, the special expertise and experience of appellate courts in assessing the relative force of competing interpretations and applications of legal norms makes the case for de novo review of judgments of this order even stronger than the case for such review of paradigmatic conclusions of law. Any uncertainty we might have regarding the appropriate classification of rulings of this kind is alleviated by consideration of the central purpose of the EAJA. The disincentive to challenge unreasonable governmental action caused by fear of incurring large litigation expenses will be significantly reduced only if potential litigants are able to predict reasonably accurately whether they ultimately will be able to recover their attorneys’ fees. Their ability to make such predictions, in turn, is dependent on the consistency with which the EAJA is interpreted — i.e., with which the justifications for (losing) legal arguments are assessed. Nondeferential appellate review of such assessments will best achieve a goal of consistency and thus enable the Act more effectually to serve its intended social functions.
712 F.2d at 563-64 (footnote omitted) (emphasis in the original). We also agree with this reasoning.
B.
Because the facts surrounding the controversy in Spencer were undisputed, see id. at 567, the court did not have to decide the scope of review of EAJA decisions where the issue is the district court’s evaluation of the plausibility of the government’s factual position. In dicta, however, the court reasoned that such judgments are more properly classified as factual findings, subject to clearly erroneous review *963because “they involve the same kind of evaluation of the credibility of witnesses and weighing of evidence entailed by ordinary findings of fact — and at which trial judges are especially experienced and skilled.” Id. at 564. Although the facts in this appeal, as in Spencer, are not disputed, we are squarely presented with this question in the companion case of Dennis v. Heckler, 756 F.2d 971 (3rd Cir.1985), where we focus on the Secretary’s factual position. The government contends that the standard of review in such cases should be clearly erroneous.
In concluding that judgments concerning the government’s characterization of the underlying facts should be subject to clearly erroneous review, the Spencer court was apparently assuming that the district court would have an opportunity to evaluate the credibility of witnesses and to weigh the evidence. In both Dennis and the instant appeal, however, the district court is performing precisely the same function of reviewing the Secretary’s factual and legal position as we perform. Because there is no qualitative difference in the method of the two reviews, we find that there is no reason to defer to the judgment of the district court and therefore conclude that the plausibility of the factual as well as legal basis of the government’s position is subject to plenary review.4
We now turn to an analysis of the facts of record and then to the discussion of whether the government’s position was substantially justified.
III.
A.
It is undisputed that Washington, a fifty-three year old man with an eighth grade education, has a serious low back condition. After a myelogram revealed a defect at L5, a lumbar laminectomy and nerve root decompression was performed in May 1978 to correct a disc condition. However, John L. Sbarbaro, M.D., an orthopedic surgeon who examined Washington on behalf of the Secretary, reported in October 1979 that Washington had not improved since his surgery and that he had “dramatic stiffness in his low back [which] is characteristic of either a degenerative process or a chronic inflammatory process of the lower back.” Administrative Record at 134. Dr. Sbarba-ro noted that Washington appeared to be in constant pain and concluded that he “may well be permanently disabled.” Id. B. Thakarar, M.D., an orthopedic surgeon who also examined Washington on behalf of the Secretary, reported in August 1981 that Washington had chronic arachnoiditis and degenerative joint disease, and that he was restricted from any activities that require movement of the cervical and lumbar spine area, including pushing, pulling, bending, and prolonged sitting, standing, and walking. Id. at 178. Even Dr. Martin Blaker, the orthopedic surgeon most relied upon by the Secretary, reported in August 1980 that Washington should restrict activities affecting the lower back. Id. at 139.
There is also undisputed evidence that Washington suffers from a serious emotional disorder. Lance S. Wright, M.D., a psychiatrist, examined Washington on behalf of the Secretary and reported on September 13, 1981, that his mental status examination revealed that Washington’s affect was “flat to depressed,” that he claimed suicidal ideations (though he had never made any attempt), and that he suffered, inter alia, from recurrent depression and alcohol abuse. Id. at 184. Dr. Wright indicated that Washington’s prognosis was “poor.” Id. There was countervailing evidence about Washington’s emotional condition in the form of a psychological report submitted under the auspices of Napoleon Vaughn, Ed. D., but prepared and signed by one E. Meinhart, a “psychologist’s assistant.” This report contains a history and the results of a clinical interview and psychological testing, and con-*964eludes in a section marked “Recommendations” that:
The psychological testing does not find Mr. Washington warrants Social Security Benefits. His intelligence falls within the normal range. There is no organicity. Granted, reading, spelling and arithmetic categorize him as an academic cripple, but he does manage his funds, pay bills, etc., without being cheated out of his money.
A psychiatric evaluation is strongly recommended for this claimant.
Id. at 175.
B.
The AU conducted a hearing at which he received the medical records and the testimony of Mr. Washington. The AU did not call a vocational expert. Washington testified that he only completed the eighth grade in school, that his work history consisted primarily of doing handiwork (painting and paperhanging) and that he had not worked at all since 1976 when he injured his back. He complained of constant low back and leg pain which had not been improved by surgery (he testified that he uses a cane when he walks inside his house, but that he is afraid to use the cane when walking outside), and stated that he drinks to relieve his pain. Washington also testified about his psychological history, relating that he went to a psychiatrist several times in the late 1970’s because he was depressed and suicidal. He claimed still to have depression and to think occasionally about suicide.
The AU agreed that Washington could not return to his former occupation, see id. at 13, and conceded that, if credited, Washington’s testimony would be consistent with a finding that he was physically unable to work at all.5 Id. at 11. However, the AU determined that the testimony should not be credited. First, he reasoned that the orthopedic evidence did not document a condition that would account for Washington’s claimed severe pain. Id. The AU also opined that Washington was not a credible witness because he had changed his testimony to avoid the conclusion that he could perform work permitting alternating sitting and standing, e.g., the job of a tailor, for which he might be retrained. Id. at 12. Thus the AU found that Washington could perform a wide range of sedentary work. Id. at 13. With respect to the psychiatric evidence, the AU concluded that it did not establish an impairment that “significantly limits the range of light work the claimant can do.” Id. The AU stated that:
[Washington’s] intelligence is dull normal and there is no evidence of brain damage due to alcohol or any other cause. He is depressed and ruminates on his physical problems, which demonstrates a constriction of interests and may indicate some resulting limitation of daily activities, but the deterioration in personal habits and relationships which evidence [sic] severe depression has not been documented. Moreover, for the reasons set forth above, I do not believe that the claimant is as depressed as he claims. There is no evidence that he cannot control his drinking or that it has caused functionally limiting physical or mental damage.
Id.
On the basis of these findings, the AU applied the Medical-Vocational Guidelines, 20 C.F.R. § 404, Subpart P, Appendix 2 (“the grids”):
As of August 1980 the claimant’s factors of age, education, work experience and residual functional capacity are the same as those in Rule 202.17 in Appendix 2 of Subpart P of 20 C.F.R. 404, which directs a decision of not disabled (and after the claimant’s 50th birthday, all criteria of Rule 202.10, which also directs denial, are met).
Administrative Record at 14. The AU therefore concluded that Washington was not precluded by any medically determinable impairment from engaging in all sub*965stantial gainful work activity and, hence, was not disabled. Id.
C.
The United States Magistrate, to whom the case was referred by the district court, reviewed the medical evidence and determined on a number of grounds that Washington’s motion for summary judgment should be granted and the case remanded to the Secretary with a direction to reinstate his SSI benefits. First, citing Bay-kara v. Harris, 696 F.2d 980 (3d Cir.1982) (unpublished opinion), the Magistrate concluded that the ALJ had disregarded without a thorough explanation an uncontra-dicted medical report, submitted by a physician selected by the Social Security Administration (Dr. Thakarar), that was highly favorable to the claimant. The Magistrate also observed that the AU had substituted his own expertise for that of the examining physicians in violation of Fowler v. Califa-no, 596 F.2d 600, 603 (3d Cir.1979). He thus concluded that the Secretary’s finding that Washington was able to perform light work was arbitrary and not supported by substantial evidence.6 Appendix at 59.
With respect to the psychiatric evidence, the Magistrate concluded that the AU had again unfairly discounted, without explanation, competent medical evidence submitted by the Secretary’s own physician. Specifically, the Magistrate concluded that the AU had improperly ignored Dr. Wright’s diagnoses that plaintiff suffers from a major affective disorder, recurrent depression, and postoperative residual pain, and had once again employed his own lack of expertise to conclude that Washington’s mental limitations impose “ ‘no significant functional restrictions’.” Id. at 60. Additionally, and most importantly, the Magistrate noted that:
having found that plaintiff suffered from depressive reaction, a nonexertional impairment, the Secretary was directed by the Regulations to make his determination of disability in “full consideration ... [of] all of the relevant facts in the ease”, 20 C.F.R. pt. 404, subpt. P, app. 2, § 200.00(e)(2), and not in strict accordance with the Medical-Vocational Guidelines which he did. Burnam v. Schweiker, 682 F.2d 456 (3d Cir.1982). See San-tise v. Schweiker, 676 F.2d 925, 934-35 (3d Cir.1982) (guidelines “ ‘may not be fully applicable’ where a claimant suffers from non-exertional, instead of or in addition to exertional, impairments”).
Id. at 61.7
The district court adopted the Magistrate’s report and recommendation and remanded the case to the Secretary with the instruction that SSI benefits be reinstated.8 Id. at 49.
IV.
The district court addressed Washington’s timely petition for counsel fees under the EAJA in a comprehensive and thoughtful opinion. Washington v. Heck*966ler, 573 F.Supp. 1567 (E.D.Pa.1983). The court summarized the relevant medical evidence and the standard announced by this court in Dougherty v. Lehman, 711 F.2d 555 (3d Cir.1983), noting that, under Dougherty, a finding that the underlying agency ruling was not supported by substantial evidence does not necessarily indicate that the position asserted by the government lacks a substantial basis. The court then proceeded to review the medical evidence according to the Dougherty standard. 573 F.Supp. at 1570-71.
First, the district court relied upon the report of Dr. Vaughn to hold that the Secretary had a reasonable basis in fact for her contention that Washington suffered no significant non-exertional impairment.9 See id. at 1571-72.
While viewing the question of Washington’s physical impairments as more serious, the court was persuaded that sufficient evidence existed to support the Secretary’s conclusion that Washington was capable of performing light work.10 Id. at 1572. Finally, the district court decided that the Secretary’s legal theory was substantially justified, and that the facts alleged by the Secretary reasonably supported her legal theory. Id. at 1573.
In this appeal, Washington argues that the Secretary’s refusal to award disability benefits cannot be deemed “substantially justified,” because, inter alia, the Secretary failed to evaluate his exertional and non-exertional impairments together, in violation of Burnam v. Schweiker, 682 F.2d 456 (3d Cir.1982). The district court’s only consideration of this issue was as follows:
Although I recognize that in an appropriate case the Secretary’s reliance upon exertional impairment criteria to defend her denial of benefits to a claimant afflicted by a nonexertional disorder might not satisfy her burden under the substantial justification test, this is not such a case. The evidence of plaintiff’s psychological stability submitted to the ALJ through the reports of Dr. Vaughn and Dr. Wright was certainly sufficient to provide the Secretary with substantial justification for her assertion that the exertional impairment criteria should apply to plaintiff’s claim.
573 F.Supp. at 1573.11
V.
As the district court found in the underlying case, the ALJ erred in applying the grids to Washington’s disability determination. The Supreme Court held in Heckler v. Campbell, 461 U.S. 458, 103 S.Ct. 1952, 76 L.Ed.2d 66 (1983), that the Secretary may use the grids to determine whether jobs exist in the national economy that a person with the claimant’s qualifications and limitations could perform. In order to show that a claimant is able to engage in alternative gainful employment, however, the Secretary must first show that a claimant’s vocational profile is precisely contained within the guidelines established for each rule of the grid. See Santise v. Schweiker, 676 F.2d 925 (3d Cir.1982); 20 C.F.R. Part 404, Appendix 2, § 200.00(d). The grids will be of limited help when a “claimant suffers from non-exertional, instead of or in addition to exertional impairments.” 676 F.2d at 934-35; 20 C.F.R. Part 404, Appendix 2, § 200.00(e). *967And, where a claimant has both exertional and non-exertional impairments, the ALJ must evaluate them together to determine whether a claimant who suffers from a combination of these is disabled. Burnam v. Schweiker, 682 F.2d 456, 458 (3d Cir. 1982).12
Because the grids themselves do not justify a conclusion as to disability, when there are both exertional and non-exertional impairments, the Secretary must rely upon some other supporting evidence in the record to demonstrate that the claimant can perform work available in the national economy. The ALJ did not call a vocational expert who might have considered the full scope of Washington’s impairments and evaluated whether a person with Washington’s exertional and non-exertional impairments could perform general light work available in the national economy. Rather, notwithstanding the presence of both serious exertional and non-exertional impairments, the AU simply applied the grids. This action is in violation of Bur-nam.13
The Secretary contends, however, that “[wjhere impairments result in both strength and nonexertional limitations ... the [grids] are not completely disregarded.” Supplemental Letter Brief of Appellee, at 6.14 The Secretary submits that Burnam does not preclude the use of the grids as a “framework” for determining the extent to which a non-exertional limitation may further diminish work capacity, and, therefore, that the Secretary’s position in this case was substantially justified. We need not resolve the merits of this “framework” approach as a general matter, because, given the Secretary’s failure to present any evidence of Washington’s ability to work independent of the prescriptions of the grids, a finding that appellant was not disabled is simply contrary to this Court’s precedent extant at the time Wash*968ington’s disability determination was made.15
VI.
It is plain from the foregoing discussion that the Secretary’s position both in the agency and the district court16 clearly offends our established precedents. As such it has no reasonable basis and is not substantially justified. Accordingly, the judgment of the district court will be reversed and the case remanded for determination of an appropriate fee under the EAJA.