
543 F.3d 564 (2008)
Nadeem HASSAN, Plaintiff-Appellant,
v.
Michael CHERTOFF, Secretary of Department of Homeland Security; Al Gallmann, Acting District Director, Phoenix District Office, Citizenship and Immigration Service, Defendants-Appellees.
No. 06-17252.
United States Court of Appeals, Ninth Circuit.
Argued and Submitted June 13, 2008.
Filed September 11, 2008.
*565 Eric G. Bjotvedt, Esq., Phoenix, AZ, for plaintiff/appellant, Nadeem Hassan.
Thomas H. Dupree, Jr., Esq. USDOJ, Washington, D.C., for defendants/appellees, Michael Chertoff, Secretary of Homeland Security et al.
Before: MARY M. SCHROEDER, JOHN M. WALKER, JR.,[*] and N. RANDY SMITH, Circuit Judges.
PER CURIAM:
Nadeem Hassan, a citizen of Pakistan, appeals the district court's dismissal of his complaint seeking mandamus relief and challenging the government's denial of his application for adjustment of status and cancellation of his permission to return to this country. We lack jurisdiction to review the government's actions and affirm the district court's dismissal. See 8 U.S.C. § 1252(a)(2)(B)(i)-(ii).

Background
In January 2002, while physically present in the United States, Hassan applied for adjustment of status to lawful permanent resident pursuant to section 245 of the Immigration and Nationality Act ("INA"), 8 U.S.C. § 1255(a). In October 2004, the government had not yet acted on his application, so he filed this mandamus action in the United States District Court to compel the government to act on the application. In 2005, the government questioned him about possible ties to a group the government suspected of having links to terrorists.
While his adjustment application was still pending, Hassan traveled outside the United States to Saudi Arabia. He received a travel document from the government, Form I-512, commonly referred to as an "advance parole." It granted him permission to return to the United States, so long as his application for adjustment remained pending. While Hassan was abroad, the government denied his adjustment application and revoked the advance parole. When he attempted to return to the United States, he was denied admission, placed in expedited removal proceedings, and removed. He then amended his complaint in this action to challenge the denial of status adjustment and revocation of advance parole.
*566 The district court held that under the REAL ID Act of 2005, 8 U.S.C. § 1252(a)(2)(B), both the denial of the adjustment of status and the revocation of the advance parole were discretionary decisions that the court lacked jurisdiction to review. The statute the court relied upon with respect to adjustment of status provides that "no court shall have jurisdiction to review any judgment regarding the granting of relief under section ... 1255 of this title...." 8 U.S.C. § 1252(a)(2)(B)(i). The statute the district court relied on to determine that it lacked jurisdiction to review the revocation of advance parole is 8 U.S.C. § 1252(a)(2)(B)(ii), which provides that "no court shall have jurisdiction to review any other decision ... of the Attorney General or the Secretary of Homeland Security the authority for which is specified under this subchapter to be in the discretion of the Attorney General or the Secretary of Homeland Security...."

Analysis
Hassan argued to the district court that before the government denied his application for adjustment of status, it should, under an applicable regulation, have given him an opportunity to respond to the reasons for the denial. See 8 C.F.R. § 103.2(b)(16)(i). But, as the district court noted, judicial review of the denial of an adjustment of status applicationa decision governed by 8 U.S.C. § 1255is expressly precluded by 8 U.S.C. § 1252(a)(2)(B)(i). Furthermore, § 1252(a)(2)(B)(ii) precludes judicial review of "any other [discretionary] decision or action of the Attorney General or the Secretary of Homeland Security." Because the government denied Hassan's application for adjustment, in part, as a matter of discretion, the district court lacked jurisdiction to review that claim. Cf. Hosseini v. Gonzales, 464 F.3d 1018, 1021 (9th Cir. 2006) ("We lack jurisdiction to review the BIA's denial of Hosseini's adjustment of status claim because the BIA alternatively denied relief as a matter of discretion.").
To the extent that Hassan argues that he is not appealing a discretionary decision to deny his application but is raising a constitutional claim or question of law as to whether the government violated their own regulation and Hassan's due process rights, we reject that argument. Although 8 U.S.C. § 1252(a)(2)(D) preserves jurisdiction over "constitutional claims or questions of law raised upon a petition for review filed with an appropriate court of appeals in accordance with this section," that provision is inapplicable here. Hassan's challenge to the denial of adjustment was not raised upon a petition for review filed with this court; his case comes to us on direct appeal from the district court. We therefore conclude that the district court did not have jurisdiction to entertain Hassan's challenge to the denial of adjustment of status.
The only remaining question pertains to the revocation of Hassan's advance parole. The district court ruled that it lacked jurisdiction to consider the issue because the revocation of advance parole, like the grant of advance parole, is discretionary. See 8 U.S.C. § 1182(d)(5)(A) (stating that the Attorney General may "in his discretion parole into the United States ... any alien"); see also Samirah v. O'Connell, 335 F.3d 545, 548 (7th Cir.2003) ("The Attorney General ... has the discretion to revoke advance parole after it has been granted.").
On appeal, Hassan argues that the district court had jurisdiction to review the revocation. He claims that the government lacked any discretion to revoke his advance parole because no statute or regulation expressly authorizes revocation. We disagree. The statutory and regulatory *567 provisions governing the grant of parole provide for the revocation of parole when it no longer serves its purpose. See 8 U.S.C. § 1182(d)(5)(A) ("[W]hen the purpose of such parole shall, in the opinion, of the Attorney General, have been served the alien shall forthwith return or be returned to the custody from which he was paroled and thereafter his case shall continue to be dealt with in the same manner as that of any other applicant for admission to the United States."); 8 C.F.R. § 212.5(e)(2)(i) (providing that DHS "shall" terminate parole "upon accomplishment of the purpose for which parole was authorized or when in the opinion of [certain enumerated DHS officials], neither humanitarian reasons nor public benefit warrants the continued presence of the alien in the United States"); see also Samirah, 335 F.3d at 548 (interpreting these provisions as granting DHS authority to revoke advance parole).
DHS complied with these regulations when it revoked Hassan's advance parole. It is undisputed that Hassan was granted advance parole solely to allow him to return to this country while his application for status adjustment was pending. Thus, once Hassan's application for adjustment of status was denied, he was no longer eligible for advance parole. See U.S. Citizenship & Immigration Servs., Dep't of Homeland Sec., Adjudicator's Field Manual § 54.3 (2008) (providing that an applicant for adjustment of status is eligible for advance parole only if his application has not yet been decided). The revocation inevitably followed from DHS's discretionary decision to deny the adjustment of status. Under these circumstances, DHS was required by its own regulation to terminate the advance parole, the parole having served its purpose. See 8 C.F.R. § 212.5(e)(2)(i).
The district court properly rejected Hassan's argument that it had jurisdiction to review the revocation of advance parole as an ultra vires. The revocation was lawfully authorized.
For the foregoing reasons, we lack jurisdiction to review the government actions challenged by Hassan. We therefore affirm the district court's dismissal of his case.
AFFIRMED.
NOTES
[*]  The Honorable John M. Walker, Jr., Senior U.S. Circuit Judge for the Second Circuit, sitting by designation.
