
195 S.W.3d 98 (2006)
THE UNIVERSITY OF TEXAS MEDICAL BRANCH AT GALVESTON, Petitioner,
v.
THE ESTATE OF DARLA BLACKMON, by its Beneficiary Sheila SHULTZ, and Sheila Shultz, Individually, Respondents.
No. 05-0594.
Supreme Court of Texas.
June 9, 2006.
*99 Greg Abbott, Attorney General of Texas, Barry Ross McBee, Edward D. Burbach, Rafael Edward Cruz, Ryan D. Clinton, Office of the Attorney General, Nichelle A. Cobb, Tort Litigation Division, Austin, for *100 The University of Texas Medical Branch at Galveston.
Stephen A. Khoury, Kelsoe Anderson Khoury & Clark, Dallas, for The Estate of Darla Blackmom and Sheila Shultz.
PER CURIAM.
While the petitioner's interlocutory appeal from its plea to the jurisdiction was pending in the court of appeals, the respondent filed a nonsuit. We conclude that the nonsuit deprived the court of appeals of jurisdiction, and we vacate its order and dismiss this interlocutory appeal for want of jurisdiction.
Darla Blackmon died of pneumonia while incarcerated at a Texas Department of Criminal Justice substance abuse facility operated by the University of Texas Medical Branch at Galveston (UTMB). Blackmon's daughter, Sheila Shultz, brought suit for wrongful death and survival damages, claiming that UTMB negligently failed to diagnose and treat her mother's illness. Shultz alleged a waiver of sovereign immunity under the Tort Claims Act's exception for personal injury or death caused by a condition or use of tangible personal property. See TEX. CIV. PRAC. & REM. CODE § 101.021(2). UTMB filed a plea to the jurisdiction, which the trial court denied, and then brought an interlocutory appeal. See id. § 51.014(a)(8).
The court of appeals initially reversed the trial court's order and rendered judgment for UTMB, but then withdrew its judgment upon granting Shultz's motion for rehearing. Three weeks later, Shultz filed a nonsuit and moved to dismiss the appeal for want of jurisdiction. The court of appeals denied Shultz's motion, and eventually issued a new opinion denying UTMB's plea to the jurisdiction. 169 S.W.3d 712. Responding to UTMB's appeal in this Court, Shultz contends that there is no longer a case or controversy, and that her nonsuit deprived the court of appeals of jurisdiction over UTMB's appeal. We agree.
Under the Texas Rules of Civil Procedure, "[a]t any time before the plaintiff has introduced all of his evidence other than rebuttal evidence, the plaintiff may dismiss a case, or take a non-suit, which shall be entered in the minutes." TEX. R. CIV. P. 162. Rule 162 applies in this case because Shultz filed the nonsuit while this matter was pending on interlocutory appeal from UTMB's pretrial plea to the jurisdiction. Under these circumstances, the nonsuit extinguishes a case or controversy from "the moment the motion is filed" or an oral motion is made in open court; the only requirement is "the mere filing of the motion with the clerk of the court." Shadowbrook Apts. v. Abu-Ahmad, 783 S.W.2d 210, 211 (Tex.1990); see also Greenberg v. Brookshire, 640 S.W.2d 870, 872 (Tex.1982). While the date on which the trial court signs an order dismissing the suit is the "starting point for determining when a trial court's plenary power expires," a nonsuit is effective when it is filed. In re Bennett, 960 S.W.2d 35, 38 (Tex.1997); TEX. R. CIV. P. 329b. The trial court generally has no discretion to refuse to dismiss the suit, and its order doing so is ministerial. In re Bennett, 960 S.W.2d at 38; Shadowbrook, 783 S.W.2d at 211.
Of course, the trial court need not immediately dismiss the suit when notice of nonsuit is filed. Rule 162 states that the plaintiff's right to nonsuit "shall not prejudice the right of an adverse party to be heard on a pending claim for affirmative relief or excuse the payment of all costs taxed by the clerk," and a dismissal "shall have no effect on any motion for sanctions, attorney's fees or other costs, pending at the time of dismissal." TEX. R. *101 CIV. P. 162. A claim for affirmative relief must allege a cause of action, independent of the plaintiff's claim, on which the claimant could recover compensation or relief, even if the plaintiff abandons or is unable to establish his cause of action. BHP Petroleum Co., Inc. v. Millard, 800 S.W.2d 838, 841 (Tex.1990). UTMB has not raised a claim for affirmative relief, but it did request costs in its plea to the jurisdiction. Rule 162 permits the trial court to hold hearings and enter orders affecting costs, attorney's fees, and sanctions, even after notice of nonsuit is filed, while the court retains plenary power. In re Bennett, 960 S.W.2d at 38. Thus, the trial court has discretion to defer signing an order of dismissal so that it can "allow a reasonable amount of time" for holding hearings on these matters which are "collateral to the merits of the underlying case." Id. at 38-39. Although the Rule permits motions for costs, attorney's fees, and sanctions to remain viable in the trial court, it does not forestall the nonsuit's effect of rendering the merits of the case moot.
Finally, UTMB argues that a plaintiff cannot nonsuit a claim once a court has rendered a judgment on the merits. See Hyundai Motor Co. v. Alvarado, 892 S.W.2d 853, 854 (Tex.1995) (holding that a nonsuit results in a dismissal with prejudice as to claims already adjudicated on partial summary judgment). In this case, however, the court of appeals withdrew its judgment for UTMB before the nonsuit was filed. As a result, the nonsuit vitiated only the trial court's interlocutory order denying UTMB's plea to the jurisdiction. That ruling favored Shultz and, consequently, its nullification did not prejudice UTMB.
The court of appeals lacked jurisdiction to issue an order and opinion on rehearing. Accordingly, without hearing oral argument, we grant the petition for review, vacate the court of appeals' order, and dismiss the appeal for want of jurisdiction. TEX. R. APP. P. 59.1, 60.2(e).
