
    Victor Manuel RODRIGUEZ, on his own behalf, Appellant v. Samuel SALUS, Judge, Court of Common Pleas for Montgomery County, Pennsylvania, Norristown, PA; Joseph P. Mascaro, District Attorney for Montgomery County, Pennsylvania; Mary Fitipaldi, District Attorney for Montgomery County, Pennsylvania, Norristown, PA; Mary MacNeill Killinger, District Attorney for Montgomery County, Pennsylvania, Norristown, PA; Richard J. Hodgson, Judge, Court of Common Pleas, Norristown, PA; Walter Dunsmore, Attorney; Xavier P. Hayden, Attorney; Francis M. Walsh, Attorney, Norristown PA; James T. Owens, Attorney, West Chester, PA; Fidel Balan, Police Officer, City of New York; Angel Hernandez, Citizen, City of Norristown, PA; Panel of Superior Court on September 24th, 1999, December 31st 2007; Panel of Supreme Court on May 17th 2000, July 10th 2008 and May 31st 2012, All, individually, Officially and Collectively.
    No. 15-2142.
    United States Court of Appeals, Third Circuit.
    Submitted for Possible Dismissal Pursuant to 28 U.S.C. § 1915(e)(2)(B) or Summary Action
    Pursuant to Third Circuit LAR 27.4 and I.O.P. 10.6 Dec. 10, 2015.
    Filed: Dec. 15, 2015.
    Victor Manuel Rodriguez, on his own behalf, Marienville, PA, pro se.
    Robert M. Falin, Esq., Norristown, PA, for Defendant-Appellee.
    Before: AMBRO, SHWARTZ and GREENBERG, Circuit Judges.
   OPINION

PER CURIAM.

Victor Manuel Rodriguez, a state prisoner, appeals an order of the United States District Court for the Eastern District of Pennsylvania dismissing as legally frivolous his civil rights action brought pursuant to 42 U.S.C. § 1983. We will summarily affirm.

In 1998, the Court of Common Pleas of Montgomery County, Pennsylvania, sentenced Rodriguez to life imprisonment without parole following his conviction for first degree murder and criminal conspiracy. The Pennsylvania Superior Court affirmed the judgment of sentence on direct appeal, and the Pennsylvania Supreme Court subsequently denied review. Rodriguez’s petition for relief under Pennsylvania’s Post Conviction Relief Act and his habeas petition pursuant to 28 U.S.C. § 2254 were unsuccessful.

In November 2015, Rodriguez filed a complaint under § 1983, naming numerous individuals involved in his criminal case and appeals, including judges, prosecutors, defense attorneys, a police officer who testified at trial, and the brother of his co-defendant, who allegedly threatened witnesses in an effort to have them inculpate Rodriguez. In the complaint, Rodriguez essentially alleged that those defendants conspired to convict him of a crime that he did not commit and attempted to thwart his ability to overturn his conviction. As relief, Rodriguez sought immediate release, monetary damages, and an injunction prohibiting his future incarceration. The District Court dismissed the case as legally frivolous under 28 U.S.C. § 1915(e)(2)(B)©, concluding that Rodriguez’s claims were barred by Heck v. Humphrey, 512 U.S. 477, 114 S.Ct. 2364, 129 L.Ed.2d 383 (1994). Rodriguez filed a motion for reconsideration, which the District Court denied. Rodriguez appealed.

We have jurisdiction over this appeal pursuant to 28 U.S.C. § 1291, and exercise plenary review over the District Court’s dismissal of the complaint as frivolous. See Roman v. Jeffes, 904 F.2d 192, 194 (3d Cir.1990). We construe the complaint liberally, Haines v. Kerner, 404 U.S. 519, 520, 92 S.Ct. 594, 30 L.Ed.2d 652 (1972), and may affirm on any basis supported by the record. Fairview Twp. v. EPA, 773 F.2d. 517, 525 n. 15 (3d Cir.1985).

After considering the record below, we agree that Rodriguez’s claims are not cognizable in a § 1983 action. Under Heck, “when a state prisoner seeks damages in a § 1983 suit, the district court must consider whether a judgment in favor of the plaintiff would necessarily imply the invalidity of his conviction or sentence; if it would, the complaint must be dismissed unless the plaintiff can demonstrate that the conviction or sentence has already been invalidated.” 512 U.S. at 487, 114 S.Ct. 2364. In Edwards v. Balisok, 520 U.S. 641, 117 S.Ct. 1584, 137 L.Ed.2d 906 (1997), the Court extended Heck and found a claim for declaratory relief not cognizable under § 1983 because it would “neees-sarily imply the invalidity of the punishment imposed.” Id. at 648,117 S.Ct. 1584. Heck and Balisok foreclose § 1983 claims only in a “narrow subset of actions,” where the deprivation of rights is such that it necessarily affects the fact or length of detention. Leamer v. Fauver, 288 F.3d 532, 540 (3d Cir.2002). “[Wjhenever the challenge ultimately attacks the ‘core of habeas’ — the validity of the continued conviction or the fact or length of the sentence — a challenge, however denominated and regardless of the relief sought, must be brought by way of habeas corpus petition. Conversely, when the challenge is to a condition of confinement such that a finding in plaintiffs favor would not alter his sentence or undo his conviction, an action under § 1983 is appropriate.” Id. at 542.

To the extent that Rodriguez seeks to challenge his conviction based on alleged violations of his constitutional rights at trial and on appeal, those claims must be raised in a habeas petition. Id.; Wilkinson v. Dotson, 544 U.S. 74, 82, 125 S.Ct. 1242, 161 L.Ed.2d 253 (2005) (stating that claims that, if successful, would “spell speedier release ... lie[ ] at the core of habeas corpus.” (internal quotation and citation omitted)). To the extent that Rodriguez seeks damages and declaratory relief based on alleged constitutional violations related to his conviction, his claims are barred by Heck. Success on those claims would necessarily imply the invalidity of his conviction, which has not been overturned or invalidated. Heck, 512 U.S. at 487, 114 S.Ct. 2864.

Accordingly, we will summarily affirm the District Court’s order dismissing Rodriguez’s complaint because the appeal presents no substantial question. 
      
      This disposition is not an opinion of the full Court and pursuant to I.O.P. 5.7 does not constitute binding precedent.
     
      
      . Rodriguez also sought the initiation of criminal charges against the defendants under 18 U.S.C. §§ 241 and 242. The District Court properly rejected this claim because there is no federal right to require the government to initiate criminal proceedings. See Linda R.S. v. Richard D., 410 U.S. 614, 619, 93 S.Ct. 1146, 35 L.Ed.2d 536 (1973); United States v. Berrigan, 482 F.2d 171, 173-74 (3d Cir.1973). There is also no merit to Rodriguez’s suggestion that amendments to Pennsylvania’s murder statute have no force or effect because they were not "carried over as required under legislative mandates.”
     
      
      . The District Court also properly noted "several other problems” with Rodriguez's complaint: the judges were immune from claims based on acts that they took in their judicial capacity, see Figueroa v. Blackburn, 208 F.3d 435, 440-41 (3d Cir.2000); immunity barred damage claims against the prosecutors for their actions in initiating, presenting, and advocating the Commonwealth’s case; and a police officer was immune from claims based on his trial testimony, see Briscoe v. LaHue, 460 U.S. 325, 326, 103 S.Ct. 1108, 75 L.Ed.2d 96 (1983).
     
      
      . Because it is apparent that amendment of the complaint would have been futile, there was no need for the District Court to provide Rodriguez with leave to amend before dismissing his complaint. See Phillips v. County of Allegheny, 515 F.3d 224, 236 (3d Cir.2008).
     
      
      . Rodriguez’s motion to strike the appearance of the attorney representing the Montgomery County District'Attorney's Office is denied,
     