
790 P.2d 1137 (1990)
309 Or. 671
Gilbert L. LANE, Respondent On Review,
v.
Manfred MAASS, Superintendent, Oregon State Penitentiary Petitioner On Review.
CC 88 C 10808; CA A50272; SC S36636.
Supreme Court of Oregon, En Banc.
Argued and Submitted February 8, 1990.
Decided April 26, 1990.
Janet A. Metcalf, Asst. Atty. Gen., Salem, argued the cause for petitioner on review. With her on the petition were Dave Frohnmayer, Atty. Gen., and Virginia L. Linder, Sol. Gen., Salem.
Jay Edwards, Salem, argued the cause and filed a response for respondent on review.
PETERSON, Chief Justice.
The issue presented is whether a motion to dismiss pursuant to ORCP 21 A[1] is appropriate in habeas corpus proceedings. The facts, as set forth by the Court of Appeals, are as follows:
"In his petition, plaintiff alleged that he was being unlawfully imprisoned and restrained, because he had been forced to provide a urine sample for drug analysis. He explained in his petition that, when he was unable immediately to provide a sample, he was threatened with a loss of privileges. After approximately 100 minutes of effort, plaintiff asked that the sample be obtained by a catheter, but his request was refused. He eventually provided the sample, but, he alleged, the effort caused dizziness and a two-hour headache.
"A writ was issued. Defendant filed a return stating only that plaintiff was lawfully imprisoned pursuant to a judgment and sentence. Plaintiff then filed a replication, and defendant moved to dismiss the petition `on the ground that the court lacks jurisdiction of the subject of the action.' ORCP 21 A(1). * * *." Lane v. Maass, 98 Or. App. 75, 77, 778 P.2d 503 (1989).
The trial court granted the motion to dismiss. The Court of Appeals reversed, stating:
"In Bedell v. Schiedler, 307 Or. 562, 770 P2d 909 (1989), the Supreme Court reviewed the dismissal of a habeas corpus petition under ORCP 21 A(1) and concluded that
"`any motion practice other than an ORS 34.680 motion to strike is inappropriate in habeas corpus actions. Any additional motion practice would only *1138 lengthen and complicate actions intended to provide an expeditious and summary resolution of the issues presented.' 307 Or at 566.
"The dismissal on the basis of ORCP 21 A(1) was, therefore, procedurally inappropriate. In the absence of a motion under ORS 34.680, the court should have proceeded to hear the evidence and decide the case. ORS 34.670; Bedell v. Schiedler, supra, 307 Or at 566 [770 P.2d 909.]" Lane v. Maass, supra, 98 Or App at 78 [778 P.2d 503.]
ORS 34.680 states:
"The plaintiff may move to strike the return, or the defendant may move to strike any new matter set forth in the replication of the plaintiff, or by proof controvert the same, as upon a direct denial or avoidance. The pleadings shall be made within such time as the court or judge shall direct, and they shall be construed and have the same effect as in an action."
Before 1979, ORS 34.680 permitted a party to test the legal sufficiency of a habeas pleading by filing a demurrer directed at the return or any new matter set forth in the replication. ORS 34.680 (1977 Replacement Part). ORS 34.680 was amended in 1979 in response to ORCP 13 C, which abolished the use of the demurrer in Oregon. Or. Laws 1979, ch. 284, § 74. The amendment replaced "demur" in ORS 34.680 with "motion to strike."[2] Concerning the 1979 amendment, we have previously noted that
"[t]he substitution of `move to strike' for demur appears to have been nothing more than an amendment adopted throughout the civil code to bring the rest of the code into line with the new Oregon Rules of Civil Procedure, which had eliminated the demurrer from the lexicon of civil pleading." Gage v. Maass, 306 Or. 196, 203 n. 7, 759 P.2d 1049 (1988).
While little legislative history is available, the history behind ORCP 21 A indicates that the abolition of the "demurrer" and the resulting amendments to the civil code were not intended to effect any substantive change. The Council's staff comment to ORCP 21 A explains that both the motion to dismiss and the motion to strike replace and perform the same function as the former demurrer. F. Merrill, Oregon Rules of Civil Procedure: 1990 Handbook 64 (1990). ("Note, the motion to strike is used to challenge the sufficiency of a defense or new matter asserted in a reply to avoid a defense, and replaces the former demurrer to an answer or a reply.") See 3 Legislative History relating to Promulgation of Oregon Rules of Civil Procedure, Memorandum from Fred Merrill, February 27, 1978.
A motion to strike, as defined in ORCP 21 E, is directed at "any sham, frivolous, or irrelevant pleading or defense or * * * any insufficient defense * * *." Although ORCP 21 E does not specifically state that the motion is used to test the "legal sufficiency" of an allegation, "[a] legally insufficient allegation * * * is, in effect, a nullity, and may be stricken as either frivolous or irrelevant." Davis v. Tyee Industries, Inc., 295 Or. 467, 482-83 n. 14, 668 P.2d 1186 (1983).
We have held that the motion to dismiss for failure to state ultimate facts sufficient to constitute a claim, ORCP 21 A, also tests the "legal sufficiency" of the pleadings and "is equivalent to the [former] demurrer." Paddack v. McDonald, 294 Or. 667, 672, 661 P.2d 545 (1983).
Procedurally, this case is virtually identical to Gage v. Maass, supra. A petition was filed, a writ was issued, and a return and replication were filed. Thereafter, the *1139 defendant moved the court "for an order dismissing petitioner's Petition for Writ of Habeas Corpus." In Gage, we affirmed the trial court's dismissal notwithstanding that "[t]he motion directed against the petition was not proper and should not have been entertained." 306 Or at 203, 759 P.2d 1049. (Footnote omitted.)
The plaintiff's attorney in the case at bar was aware of our holding in Gage for he began his answering memorandum as follows:
"Defendant has moved pursuant to ORCP 21 A(1) the court for an order dismissing petitioner's Petition for Writ of Habeas Corpus on the ground the court lacks jurisdiction of the subject of the action. (Emphasis in original.)
"The motion against the petition is not proper and should not be entertained, Gage v. Maass, 306 Or. 196, 202-203 [759 P.2d 1049] (1988)."
The trial court nonetheless treated the motion as directed against the plaintiff's replication and allowed the motion. Its order in part reads as follows:
"This matter came before the court on defendant's Motion to Dismiss the above-entitled action. * * *.
"The court being first fully advised in the premises, and finding that plaintiff's allegations in the present case do not state a claim for habeas corpus relief, and finding further that the allegations do not comprise a claim requiring immediate judicial examination, and that there are adequate alternative remedies available to plaintiff in the form of preliminary injunction and tort claims which are sufficiently timely to afford plaintiff relief, and that based on the foregoing, this court lacks habeas corpus jurisdiction over the subject matter of plaintiff's action, and the Replication fails to allege ultimate facts sufficient to constitute a claim for habeas corpus relief, [orders] that defendant's Motion to Dismiss be, and hereby is, allowed." (Emphasis added.)
We affirm for the reasons stated in Gage v. Maass, 306 Or. 196, 203, 759 P.2d 1049 (1988). However, because of the Court of Appeals' understandable reliance on Bedell v. Schiedler, supra, it is also appropriate to discuss the Bedell case.
In reversing the judgment of the trial court, the Court of Appeals relied specifically on a statement in Bedell that "any motion practice other than an ORS 34.680 motion to strike is inappropriate in habeas corpus actions." Lane v. Maass, supra, 98 Or. App. at 78, 778 P.2d 503 (quoting Bedell v. Schiedler, supra, 307 Or. at 566, 770 P.2d 909). In that case a writ had issued, a return and replication were filed, and the defendant thereafter moved to dismiss the petition[3] for lack of subject matter jurisdiction pursuant to ORCP 21 A. The trial court granted the motion. The Court of Appeals affirmed for a different reason, stating that the plaintiff "has failed to state ultimate facts sufficient to constitute a basis for habeas corpus relief." Bedell v. Schiedler, 93 Or. App. 214, 215, 761 P.2d 552 (1988). We reversed the decision of the Court of Appeals, holding that the plaintiff did in fact "allege sufficient specific facts supporting her claim." Bedell v. Schiedler, supra, 307 Or. at 570, 770 P.2d 909.
Our statement, relied on by the Court of Appeals in deciding the present case, was unnecessary to our holding in Bedell, and furthermore, was inaccurate. In the context of ORS 34.680, a motion to strike is the functional equivalent of a demurrer. Gage v. Maass, supra, 306 Or. at 203 n. 7, 759 P.2d 1049. A motion to dismiss also is the functional equivalent of a demurrer.
It would be a waste of judicial time and resources to require a habeas case to go to trial on an allegation that, if true, would establish no claim for relief. In Bedell we also stated:
"After the circuit court has received the return and the replication, if any, the *1140 case is set for summary hearing if there are any disputed fact questions. ORS 34.670. A hearing is not required if there are no disputed fact questions, or if the facts averred by the plaintiff, even if true, would be insufficient to warrant habeas corpus relief. See Keenan v. Peterson, 307 Or. 323, 767 P.2d 441 (1989)." 307 Or. at 567, 770 P.2d 909.
In Keenan v. Peterson, supra, the habeas petition did not state a claim. We stated that "[t]he trial court should have dismissed the writ without reaching the merits." 307 Or. at 325, 770 P.2d 909.
Perhaps the 1979 revisions to ORS 34.680 should have substituted "motion to dismiss" for "motion to strike." However, because of the unusual procedures in habeas cases, see Bedell v. Schiedler, supra, 307 Or. at 565-68, 770 P.2d 909, a motion to strike has the same office as a motion to dismiss. As in Gage v. Maass, supra, we treat the motion to dismiss as a motion to strike. Filing a motion to strike is the preferred way to test the legal sufficiency of a replication, ORS 34.680, but because the motion to dismiss has the same function and effect, we affirm the trial court.
The decision of the Court of Appeals is reversed. The judgment of the circuit court is affirmed.
NOTES
[1]  ORCP 21 A states in part:

"[T]he following defenses may at the option of the pleader be made by motion to dismiss: (1) lack of jurisdiction over the subject matter, * * * [and] (8) failure to state ultimate facts sufficient to constitute a claim * * *."
The defendant in this case moved to dismiss under ORCP 21 A(1). The trial court apparently treated the motion as one made under both ORCP 21 A(1) and (8).
[2]  ORCP 21 E authorizes a motion to strike as follows:

"Upon motion made by a party before responding to a pleading or, if no responsive pleading is permitted by these rules, upon motion made by a party within 10 days after the service of the pleading upon such party or upon the court's own initiative at any time, the court may order stricken: (1) any sham, frivolous, or irrelevant pleading or defense or any pleading containing more than one claim or defense not separately stated; (2) any insufficient defense or any sham, frivolous, irrelevant, or redundant matter inserted in a pleading."
[3]  As we have noted on other occasions, see, e.g., Gage v. Maass, 306 Or. 196, 202-03, 759 P.2d 1049 (1988), and again point out, once the writ has issued the petition ceases to exist. The plaintiff in Bedell v. Schiedler, 307 Or. 562, 565 n 4, 770 P.2d 909 (1990), however, did not resist the motion on the basis that the motion was directed at the petition when it should have been directed at the replication.
