—In a proceeding pursuant to CPLR article 78 in the nature of prohibition to prevent enforcement of and prosecution under certain provisions of the Yonkers City Code, the petitioners appeal from a judgment of the Supreme Court, Westchester County (Nastasi, J.), entered June 28, 2002, which denied the petition and dismissed the proceeding.
Ordered that the judgment is reversed, on the law and in the exercise of discretion, without costs or disbursements, the peti*502tion is granted, and the respondents the City of Yonkers, William Mooney, in his official capacity as corporation counsel for the City of Yonkers, and Charles Cola, in his official capacity as commissioner of police of the City of Yonkers, are prohibited from enforcing and prosecuting violations of chapter 65 of the Yonkers City Code which rely on its definition of a “vicious animal” in section 65-1 to the extent such definition is inconsistent with section 107 (5) of the New York State Agriculture and Markets Law.
Prohibition is an extraordinary remedy available only “to prevent a judicial or quasi-judicial body or officer from proceeding or threatening to proceed without or in excess of its jurisdiction, and then only if a clear legal right to that relief has been established” (Matter of Haggerty v Himelein, 89 NY2d 431, 435 [1997]; see Matter of Whitehurst v Kavanagh, 218 AD2d 366, 368 [1996]). Prohibition may lie against a prosecutor in performing the quasi-judicial role of “represent [ing] the public in bringing those accused of crime to justice” (Matter of Schumer v Holtzman, 60 NY2d 46, 51 [1983]; see Matter of Haggerty v Himelein, supra).
A writ of prohibition does not issue as of right but, rather, is a discretionary remedy (see Matter of Rush v Mordue, 68 NY2d 348, 354 [1986]; Matter of Dondi v Jones, 40 NY2d 8, 13 [1976]). In the absence of a showing that a petitioner will suffer irreparable harm if relegated to another avenue of judicial review, prohibition ordinarily does not issue where an adequate legal remedy is available, i.e., where the grievance can be addressed by other proceedings at law or in equity, such as by motion, appeal, or other applications (see Matter of Dondi v Jones, supra at 14; La Rocca v Lane, 37 NY2d 575, 579-580 [1975], cert denied 424 US 968 [1976]; see also Matter of Town of Huntington v New York State Div. of Human Rights, 82 NY2d 783, 786 [1993]; Matter of Law Offs. of Andrew F. Capoccia v Spitzer, 270 AD2d 643, 645 [2000], lv denied 95 NY2d 755 [2000]). Where, however, alternative remedies are inadequate to redress the particular grievance, prohibition may lie, for example where the petitioner is seeking to review not the error of law allegedly representing an excess of jurisdiction but rather the entertainment of the case at all (see Matter of Baltimore Mail S.S. Co. v Fawcett, 269 NY 379, 384 [1936], cert denied sub nom. Madsen v Baltimore Mail S.S. Co., 298 US 675 [1936]; Siegel, NY Prac § 559, at 924 [3d ed]; cf. La Rocca v Lane, supra at 579; Matter of State of New York v King, 36 NY2d 59, 62 [1975]). Here, the only alternative remedy that the respondents could argue to be available to the *503petitioners is a declaratory judgment action. However, a declaratory judgment action has no coercive effect (see Siegel, NY Prac § 436, at 705 [3d ed] [“A declaratory action * * * differs from all of the traditional forms of action, inherited from the courts of common law and chancery, whose judgments go to enforcement either by execution or contempt. The main distinguishing factor of the declaratory action, therefore, is the absence of coercive enforcement”]; see also Matter of Baltimore Mail S.S. Co. v Fawcett, supra at 383-384).
The petitioners do not seek review of the constitutionality of the Yonkers City Code that the Supreme Court perceived would require a declaratory judgment action. Neither do they seek a declaration that the Yonkers City Code conflicts with Agriculture and Markets Law § 107 (5); the petitioner Robert Eberhardt has prevailed in three prosecutions in the Yonkers City Court on that issue. It is the repetition of prosecution under the invalid code provisions that they seek to prevent. This can only be accomplished with a writ of prohibition (see Matter of Baltimore Mail S.S. Co. v Fawcett, supra).
Since the petitioners have established a clear legal right to the relief sought and there exists no other adequate remedy, it was an improvident exercise of discretion for the Supreme Court to deny them this relief. Florio, J.P., Schmidt, Townes and Crane, JJ., concur.