MEMORANDUM OPINION AND ORDER
WEINER, District Judge.This is an appeal from an order of the Bankruptcy Court denying petitioner’s request for attorney’s fees, 55 B.R. 207 (Bkrtcy.Pa.1985). For the reasons which follow, the decision is affirmed.
The petitioner was laid off from his job on November 19, 1982 due to a work slowdown. He subsequently obtained unemployment compensation. Before petitioner was laid off, his take home pay was $989.00 per month. His weekly unemployment compensation check totaled $858.00 per month, reflecting a decrease in income of $131.00 per month.
Petitioner subsequently requested an assignment of his mortgage from the Department of Housing and Urban Development (HUD) under its Mortgage Assignment Program. The reason for petitioner’s request for assignment of the mortgage was his inability to make his monthly mortgage payments of $145.25.1 HUD denied petitioner’s request for assignment and stated its reasons in a letter dated June 16, 1983.
Petitioner filed for relief under Chapter 7 of the Bankruptcy Code in September of 1983. He also sought judicial review of HUD’s denial of his request for assignment of the mortgage. After a motion for summary judgment, HUD agreed to accept the assignment of the mortgage. The petitioner then filed a motion for attorney’s fees against HUD under the Equal Access to Justice Act.
The Equal Access to Justice Act, 28 U.S.C. § 2412(d),2 provides for an award of fees to the prevailing party, “unless the court finds that the position of the United States was substantially justified or that special circumstances make an award unjust.” 28 U.S.C. § 2412(d)(1)(A). The burden of proving substantial justification is on the government. Miller v. United States, 753 F.2d 270, 274 (3d Cir.1985); Dougherty v. Lehman, 711 F.2d 555, 561 (3d Cir.1983). The position of the United States includes the government’s position during the litigation as well as the agency’s position that made the suit necessary. Natural Resources Defense Council v. U.S.E.P.A., 703 F.2d 700 (3d Cir.1983). 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. Miller, 753 F.2d at 274.
Petitioner contends that HUD’s failure to grant him the request for assignment of the mortgage was not substantially justified and contrary to the requirements under the Mortgage Assignment Program. On default the mortgagee may assign the mortgage to HUD to avoid foreclosure if, inter alia:
(5) The mortgagor’s default has been caused by circumstances beyond the mortgagor’s control which render the mortgagor unable to correct the delinquency within a reasonable time or make full mortgage payments.
(6) There is a reasonable prospect that the mortgagor will be able to resume full mortgage payments after a period of re*1019duced or suspended payments not exceeding 36 months and will be able to pay the mortgage in full by its maturity date extended, if necessary, by up to 10 years. 24 C.F.R. § 203.650(a)(5) and (a)(6) (1982).
Petitioner argues that since HUD did not point to any specific evidence that satisfies the second requirement, that the matter was resolved in his favor. Petitioner presses this argument in spite of evidence in the administrative record which indicates that the second requirement could have been satisfied. Petitioner is asking us to accept the stated reasons in the denial letter as the only basis for determining substantial justification. In Dougherty, supra, the court stated that:
While the arguments of the parties, and any evidence introduced in the fees action, such as affidavits, must be carefully considered, it is essentially the relevant portions of the record in the underlying action which must be looked to in order to determine if the government has proved “substantial justification” for its position.
711 F.2d at 562. This clearly indicates that the entire administrative record must be looked to when the court seeks to determine substantial justification. Cf. Securities and Exchange Commission v. Chenery, 318 U.S. 80, 63 S.Ct. 454, 87 L.Ed. 626 (1943) (in reviewing the decision of the lower court, it must be affirmed if the result is correct although the lower court relied upon a wrong ground or gave a wrong reason).
The administrative record indicates that petitioner owed $16,000 in medical bills that were not covered by insurance. HUD points to this fact as a basis for denial of the request for assignment of the mortgage. HUD maintains that the petitioner would not have been able to resume normal payments under the conditions set forth in 24 C.F.R. § 203.650(a)(6) (1982). Once the medical bills were discharged in bankruptcy, however, HUD accepted the assignment since a basis for denial no longer existed. We think this establishes substantial justification and therefore affirm the decision of the court below.
. The court below stated that the monthly mortgage payment was $167.17, however the parties as well as the administrative record indicate a monthly mortgage payment of $145.25.
. This subsection was repealed by Pub.L. No. 96-481, § 204(c), effective October 1, 1984. However, this suit was commenced before the effective date and therefore the subsection applies.