— Proceeding pursuant to CPLR article 78 (initiated in this court pursuant to CPLR 506, subd [b], par 1) to prohibit enforcement of an order of respondent Scheinman, entered January 31,1983, requiring petitioner to remit $2,000 paid to him in *843attorney’s fees. Petitioner’s second application to be relieved as defense counsel in a pending criminal prosecution entitled “People of the State of New York against Roy Weston”, was granted in an order of the Sullivan County Court (Scheinman, J.) which stated “[d]efense counsel is ordered to forthwith refund $2000 to defendant, and to turn over to new counsel all papers and information helpful to new defense counsel, and is, upon performing the foregoing, relieved”. Defendant had signed a retainer agreement providing for a $10,000 fee of which $4,000 had been paid. In this CPLR article 78 proceeding initiated in this court, petitioner seeks judgment prohibiting the enforcement of that portion of the order which required the refund. The threshold question is whether prohibition under CPLR article 78 lies. If it does, the issue is whether the trial court violated petitioner’s constitutional due process rights by requiring him to refund a portion of his fee without an evidentiary hearing as to the value of services rendered. When petitioner desired termination of his services, he correctly, albeit unsuccessfully, moved to be relieved (People v Hall, 46 NY2d 873, 875, cert den 444 US 848). Upon the second application to the court for discharge, the defendant joined asserting not only Ms desire for petitioner’s discharge, but in addition, refund of the legal fee paid. These circumstances prevailing, petitioner was required to refund promptly any part of the fee paid that had not been earned (Code of Professional Responsibility, DR 2-110, subd A, par [3]). Contrary to petitioner’s argument, it is “now well rooted in our jurisprudence, that a client may at anytime, with or without cause, discharge an attorney in spite of a particularized retainer agreement between the parties”(Demoo, Morris, Levin & Shein v Glantz, 53 NY2d 553, 556, citing Matter of Dunn, 205 NY 398 and Tenney v Berger, 93 NY 524). Demov further instructs us that the “attorney discharged without cause is limited as to recovering in quantum meruit the reasonable value of services rendered” {id., at p 557). There has long been recognition of the traditional authority of the courts to supervise the charging of fees for professional services under the court’s inherent and statutory power to regulate the practice of law {Matter of First Nat. Bank ofEastlslip v Brower, 42 NY2d 471, 474; Gair v Peck, 6 NY2d 97; Federal Land Bank of Springfield, Mass, v Ambrosano, 89 AD2d 730, 731; see Judiciary Law, § 90, subd 2). It thus became incumbent upon respondent Judge to rule both upon the motion for leave to withdraw and the quantum meruit value of petitioner’s services to that time. Respondent granted petitioner an opportunity to submit an affirmation to prove the reasonable value of such services and, upon consideration of his familiarity with the case and petitioner’s affidavit, determined the reasonable value to be $2,000 and ordered refund of the remaining $2,000. Petitioner’s reliance upon Matter of Finger, Goldberg, Zinner & Finger v Pécora (50 AD2d 530) is misplaced since that case dealt exclusively with an order which directed the petitioner to turn the fee paid him over to the Deputy Administrator of the Assigned Counsel Plan (County Law, art 18-B). Here, the direction is to make a refund to the defendant, a wholly distinguishable situation from that presented in Matter of Finger. We hold that an evidentiary hearing was not required to protect petitioner’s constitutional due process rights because neither defendant nor respondent Judge raised a triable issue as to the quantum of the services rendered. It remained only for respondent to determine from the uncontroverted facts before him, in the exercise of his discretion, the reasonable value of the services. We cannot say that the exercise of that discretion was either abused or arbitrary and capricious. It is well settled both by statute (CPLR 7803, subd 2) and established case law, that the extraordinary remedy of prohibition lies only when there is a clear legal right and only when the body or officer “acts or threatens to act without jurisdiction in a matter over which it *844has no power over the subject matter or where it exceeds its authorized powers in a proceeding over which it has jurisdiction” (Matter of State of New York v King, 36 NY2d 59, 62; see, also, Matter ofDondi v Jones, 40 NY2d 8, 13; La Rocca v Lane, 37 NY2d 575, 578-579). However, prohibition does not issue as of right, but only in the sound discretion of the court (Matter of Hogan v Court of Gen. Sessions of County ofN. Y., 296 NY 1, 8; People ex rel. Livingston v Wyatt, 186 NY 383, 393; 23 Carmody-Wait 2d, NY Prac, § 145:214, pp 785-786). In exercising this discretion, various factors are to be considered, i.e., the gravity of the harm caused by the excess of power, the availability or unavailability of an adequate remedy on appeal or at law or in equity, and the remedial effectiveness of prohibition if such an adequate remedy does not exist (Matter ofDondi v Jones, 40 NY2d 8, 13, supra; La Rocca v Lane, 37 NY2d 575, 579-580, supra). However, it has also been held that “where the lower court is exceeding its jurisdiction and the writ or order furnishes a more effective remedy, it may be availed of although the error might be corrected by appeal” (Matter of Lee v County Ct. of Erie County, 27 NY2d 432, 437, quoting from Matter of Culver Contr. Corp. v Humphrey, 268 NY 26, 39-40). Within these guidelines, our analysis of this case demonstrates that the issue arose within a pending criminal prosecution over which the trial court had jurisdiction; that petitioner was fully involved as a defense counsel; that both petitioner and the defendant presented applications to the court for leave to withdraw as counsel and replacement by new counsel; that the defendant sought the court’s aid in the return of the fee he paid; that petitioner submitted the issue of the reasonable value of his services to the court for determination, and, that the court made such evaluation. In our view, the court proceeded within its jurisdiction and exercised its discretion accordingly. We, therefore, hold that prohibition should not lie in this case. The petition should be dismissed. Petition dismissed, without costs. Sweeney, J. P., Main, Casey, Yesawich, Jr., and Weiss, JJ., concur.