
    Charles C. COOK, and others similarly situated, Does I-XXX, Plaintiff-Appellant, v. PETER KIEWIT SONS CO., Southern Electrical Contractors, Inc., Kiewit-Southern (a Joint Venture), Rodney D. Beck, Bruce Morse, Mike Rooney, Rich Nabor, David Cohee, Don Kelsey, Clint Gwynn, III, Justin M. Roach, Larry Meuwissen, Dwight C. Ely, Michael McInnis, Defendants-Appellees. Charles C. COOK and others similarly situated, Does I-XXX, Plaintiff-Appellant, v. PETER KIEWIT SONS CO., Southern Electrical Contractors, Kiewit-Southern (a Joint Venture), Rodney C. Beck, Bruce Morse, Mike Rooney, Rick Nabor, David Cohee, Don Kelsey, Clint Gwynn, III, Justin M. Roach, Larry Meuwissen, Dwight C. Ely, Michael McInnis, Thomas H. Gordinier, Kathleen T. Gunn, Donald B. Ayer, Yoshinori H.T. Himel, Greg Ciappoini, Neil Crawford, Carol Tambarelli, Milton L. Schwartz, and Does 26 through 50, Defendants-Appellees.
    Nos. 85-1649, 84-2165.
    United States Court of Appeals, Ninth Circuit.
    Argued and Submitted Aug. 13, 1985.
    Decided Oct. 31, 1985.
    
      Charles C. Cook, pro se.
    Thomas H. Gordiner, Chief Deputy County Counsel, Fairfield, Cal., for defendants-appellees.
    Before NORRIS and REINHARDT, Circuit Judges, and JAMESON, District Judge.
    
      
       The Honorable William J. Jameson, Senior United States District Judge for the District of Montana, sitting by designation.
    
   JAMESON, District Judge:

This is a consolidated appeal of judgments of dismissal in two actions instituted by Charles C. Cook, arising from Cook’s attempt to avoid the withholding of federal income taxes from his wages. In each case the district court dismissed the action with prejudice, awarded attorney fees to the defendants, released liens and lis pen-dens documents filed by Cook, and enjoined Cook from further litigating any issues raised by him in these actions and from filing further liens or other encumbrances against property belonging to the defendants.

Cook raises a number of interrelated issues on appeal. His primary contention in each case is that once the district court declared that it lacked subject matter jurisdiction, it lacked jurisdiction to award costs and attorney fees and to enjoin him from relitigating the issues raised on these actions. We affirm in part and reverse in part.

I. Facts and Proceedings Below

Cook was one of 750 to 1,000 employees of Kiewit-Southern, a joint venture of Peter Kiewit Sons Co. and Southern Electrical Contractors, Inc., who claimed exemption from income tax withholding on FORM W-4. The IRS reviewed Cook’s claim of exemption and, concluding that it lacked merit, ordered his employer to begin withholding at a specified rate. The employer complied with the order.

A. Cook I

Cook first sued his employer and some of its employees for breach of the employment contract in Superior Court, Solano County, California {Cook I). Within a few days after filing the complaint, Cook recorded a number of documents which placed liens and other impediments upon personal and real property of the Kiewit defendants and other persons named in the suit. The Kiewit defendants demurred, seeking dismissal. The United States, represented by attorney Larry Meuwissen, submitted an amicus curiae brief supporting dismissal. Cook did not oppose dismissal, and the Solano County Superior Court (Judge Dwight C. Ely) dismissed the action on June 16, 1983.

Judge Ely’s dismissal was vacated, and on rehearing Superior. Court Judge Michael Mclnnis again dismissed the action on July 15, 1983. He found the complaint did not state a cause of action and that subject matter jurisdiction was lacking. He declared the lien type documents devoid of legal effect, enjoined Cook from filing any more such documents in Solano County, and awarded attorney fees. Cook did not appeal this judgment.

B. Cook II

On June 23, 1983, Cook filed a complaint in Cook II, realleging the claims of Cook I and adding claims sounding in defamation and trespass. Cook also added as defendants counsel for the Kiewit defendants in Cook I, Judge Ely, Judge Mclnnis, Larry Meuwissen, the Solano County Clerk, a deputy clerk, and an IRS official. Since an officer of the United States was named as a defendant, the case was removed to the United States District Court for the Eastern District of California. The case was assigned to Judge Milton Schwartz.

The defendants moved for dismissal or summary judgment in Cook II, on the grounds, inter alia, of res judicata, collateral estoppel, official immunity, and lack of proper service of process. In addition, they contended that the suit was frivolous and brought in bad faith. Following a hearing and oral argument on November 18, 1983, Judge Schwartz orally indicated that he would grant the defendants’ motions. On December 22, 1983, however, before Judge Schwartz had entered a written order, he was named as a defendant in Cook III. Consequently Judge Schwartz was unable to file a written order until July 16, 1984, after Cook III had been dismissed by Judge Ramirez.

In his written order, Judge Schwartz found that the state court disposition of Cook I was res judicata as to the Kiewit defendants and therefore barred relit-igation as to them. He found further that the remaining claims were “frivolous on their face” and dismissed the claims against “the defense counsel category because no wrongful act [was] alleged, and the judge category ... because of absolute immunity for judicial acts under Bradley v. Fisher, 13 Wall. 335, 354, 80 U.S. 335, 354, 20 L.Ed. 640 (1872).” Additionally, Judge Schwartz assessed attorney fees against Cook, released all “liens” known or that should become known, and, in a separate order, enjoined Cook from relitigating any claim based on the factual and legal issues adjudicated and dismissed in Cook II.

Cook moved to vacate these orders. He argued in the main that the federal court lacked subject matter jurisdiction. Cook agreed to release all clouds on the title of Meuwissen’s property and also agreed to refrain from filing such documents in the future on the property of Meuwissen, any federal judge, agent of the IRS or United States Attorney. Although the original order did not mention as a basis of dismissal lack of subject matter jurisdiction, Judge Schwartz addressed this issue in his order denying Cook’s motion. He concluded, as did Judge Ramirez in Cook III, that “[t]here [was] ample authority for the court to dismiss this action for lack of subject matter jurisdiction on the grounds of insubstantiality.” Cook’s motion was denied.

C. Cook III

Cook’s third case was filed in federal district court. The allegations of the complaint were essentially the same as in Cook II, except for augmenting the list of defendants to include the United States Attorney who removed Cook II to federal court, the Deputy County Counsel who defended the Superior Court officers, the new counsel for the original defendants, and Judge Schwartz. Since Judge Schwartz was named as a defendant in Cook III, this case was assigned to Judge Ramirez.

Judge Ramirez’s written order was filed March 20, 1984. Judge Ramirez did not reach the defendants’ asserted grounds for dismissal. Instead, he found that “this lawsuit [was] wholly frivolous, insubstantial and groundless,” and concluded that the lawsuit “[was] outside this court’s subject matter jurisdiction.” He relied on Bell v. Hood, 327 U.S. 678, 66 S.Ct. 773, 90 L.Ed. 939 (1946), and Hagans v. Lavine, 415 U.S. 528, 537-38, 94 S.Ct. 1372, 1379, 39 L.Ed.2d 577 (1974). Judge Ramirez ordered the action dismissed for lack of subject matter jurisdiction and for failure to state a claim.

Additionally, Judge Ramirez found that Cook had brought Cook III in bad faith and for vexatious purposes. Judge Ramirez therefore enjoined Cook from again adjudicating any claim based on the same facts as those contended in Cook III, Cook II, or in Cook I. He found authority for this injunction in the All Writs Statute, 28 U.S.C. § 1651 and in Wood v. Santa Barbara Chamber of Commerce, Inc., 705 F.2d 1515 (9th Cir.1983), cert. denied, 465 U.S. 1081, 104 S.Ct. 1446, 79 L.Ed.2d 765 (1984). Finally, Judge Ramirez held that all the documents filed by Cook which clouded the title to the defendants’ property were null and void and he therefore ordered them dissolved and expunged. Cook was also enjoined from filing any other such documents based on the facts contended by Cook in Cook III, Cook II or in Cook I. Defendants’ motion for attorneys’ fees and costs were dealt with in a separate order.

Cook moved the court in Cook III to vacate or to modify its judgment. Cook agreed to release all liens he had placed on the title of Meuwissen’s property and stipulated that he would forever refrain from filing such liens on titles to property of Meuwissen, any federal judge, agent of the IRS or United States Attorney. He argued that once the court determined that it lacked jurisdiction, it was without power to act on defendants’ requests for attorney fees and injunctive relief. Judge Ramirez concluded, relying on Wood, 705 F.2d 1515, that the court had power to act as it had and that it had correctly exercised its discretion. The judgment was reaffirmed on June 6, 1984.

II. Contentions on Appeal

It is Cook’s primary contention in each case that the court, having found that it lacked subject matter jurisdiction, had no power to (1) enjoin the plaintiff from further litigation or (2) award costs and attorney fees to the defendants. In addition, Cook contends in Cook II that this action was improperly removed and should be remanded to state court; and that the court lacked authority to expunge the liens he had filed against the defendants’ property.

III. Removal of Cook II

We find no merit in Cook’s contention that Cook II was improperly removed from state court and should be remanded. 28 U.S.C. § 1442(a)(1) provides for the removal to the appropriate federal court of any civil action commenced in a state court against any “officer of the United States or any agency thereof or person acting under him, for any act under color of such of-fice____” “The only prerequisite to removal of a civil action under § 1442 is that it be brought against a federal officer or agency.” IMFC Professional Etc. v. Latin Am. Home Health, 676 F.2d 152, 156 (5th Cir.1982). (Emphasis in original). Larry Meuwissen, the attorney representing the United States in filing the amicus curiae brief, was an officer of the United States acting under color of his federal office. Cook II was properly removed to federal court.

IV. Authority to Enjoin Relitigation and Release Liens

A. Cook II

With respect to Cook II, Judge Schwartz ordered dismissal because the claims were res judicata as to the Kiewit defendants, no wrongful act was alleged against defense counsel, and the state court judges could assert the privilege of absolute immunity. He did not order dismissal for lack of subject matter jurisdiction. In view of the repetitive procedures followed by Cook, Judge Schwartz did not abuse his discretion in enjoining future litigation of the factual and legal issues involved in Cook II. See 28 U.S.C. § 1651; Wood v. Santa Barbara Chamber of Commerce, Inc., 705 F.2d 1515.

Judge Schwartz also properly released all liens filed against the defendants. See, e.g., Ryan v. Bilby, 764 F.2d 1325 (9th Cir.1985), where this court affirmed the release of liens, pursuant to I.R.C. §. 7402(a) (1982), imposed by taxpayers on the property of government officials. See also Stonecipher v. Bray, 653 F.2d 398 (9th Cir.1981), holding that an employer’s withholding of taxes did not deprive the employee of any constitutional right.

B. Cook III

In Cook III the court found that Cook was seeking to assert claims under 42 U.S.C. § 1983 and Bivens v. Six Unknown Named Agents, 403 U.S. 388, 91 S.Ct. 1999, 29 L.Ed.2d 619 (1971). Judge Ramirez found the law suit “wholly frivolous, insubstantial and groundless” and “thus outside this court’s subject matter jurisdiction.” (Citing Bell v. Hood, 327 U.S. 678, 66 S.Ct. 773, 90 L.Ed. 939 (1946) and Hagans v. Lavine, 415 U.S. 528, 537-38, 94 S.Ct. 1372, 1379, 39 L.Ed.2d 577 (1974)). Thus, the substantiality doctrine could be and was applied.

Under the substantiality doctrine, the district court lacks subject matter jurisdiction when the question presented is too insubstantial to consider. Hagans v. Lavine, 415 U.S. 528, 536-39, 66 S.Ct. at 1378-80. The claim must be “so insubstantial, implausible, foreclosed by prior decisions of this Court or otherwise completely devoid of merit as not to involve a federal controversy within the jurisdiction of the District Court, whatever may be the ultimate resolution of the federal issues on the merits.” Oneida Indian Nation v. County of Oneida, 414 U.S. 661, 666, 94 S.Ct. 772, 776, 39 L.Ed.2d 73 (1974).

The basis of the dismissal was, in fact, the Constitutional claims were not only insubstantial, but frivolous and basically therefore, there was no Federal Question jurisdiction presented to this Court.

A dismissal based on the substantiality doctrine is, in many respects, similar to a dismissal for failure to state a claim. This court, however, has recognized that there exists a threshold difference. Franklin v. Oregon State Welfare Division, 662 F.2d 1337, 1343 (9th Cir.1981). Whereas dismissal based on failure to state a claim requires a judgment on the merits and cannot be decided before the court assumes jurisdiction, a substantiality doctrine dismissal does not operate as a judgment on the merits and “thus allows a plaintiff the opportunity to seek relief in state court or to assert a claim for which the federal courts have jurisdiction.” Id. See also Bell, 327 U.S. at 682, 66 S.Ct. at 776. Judge Ramirez’s dismissal for lack of subject matter jurisdiction, thus, is not a judgment on the merits, and he retained no power to make judgments relating to the merits of the case. Judge Ramirez relied on the All Writs Act, 28 U.S.C. § 1651, and Wood, 705 F.2d at 1524, supra. Wood, however, permits the court to enjoin repetitive and vexatious litigation only after it has reached a judgment on the merits. § 1651 also requires that an injunction be issued in aid of the court’s jurisdiction. Because Judge Ramirez concluded that the court lacked subject matter jurisdiction, he did not reach a judgment on the merits and did not retain the necessary authority to issue an injunction against repetitive litigation of the factual and legal issues in Cook III.

A different situation is presented with respect to Judge Ramirez’s order in Cook III enjoining relitigation of the issues in Cook II. “A district court retains jurisdiction to enforce the judgments it [has] entered].” Wood, 705 F.2d at 1524. This court held in Wood that the court retained jurisdiction to enforce the doctrines of res judicata and collateral estoppel of a final judgment it had previously entered. The court in Wood was able to enjoin repetitive litigation at a later date. Id. This case is complicated by reason of the fact that Cook filed the third action after Judge Schwartz had ruled orally, but before a written order had been entered. Judge Ramirez in his order, however, relied on Judge Schwartz’s oral ruling, and we conclude that Judge Ramirez retained the jurisdiction to enjoin relitigation of the factual and legal issues of Cook II and correctly enjoined Cook from such relitigation. In any event, relit-igation was properly enjoined by Judge Schwartz both orally and in his subsequent written order. Moreover, the facts alleged in Cook III are essentially the same as those alleged in Cook II.

There is some confusion and uncertainty as to Cook’s contention on appeal regarding that part of the order in Cook III expunging liens on defendants’ property. In his opening brief Cook states that “[qjuestions of whether the court has jurisdiction to lift liens connected with cases in which the Respondent court does not possess subject matter to hear and decide the issues, have been settled by stipulation and are not issues in this appeal.” The stipulation, however, refers only to liens on federal defendants’ property. Both the federal defendants and the county defendants have interpreted Cook’s statement to include liens against the property of all defendants. Under the circumstances we consider this a reasonable interpretation. Moreover, it is of no practical significance, since we affirm the orders entered in Cook II releasing the liens.

V. Award of Attorney Fees

Attorney fees were properly awarded in both Cook II and Cook III, pursuant to Fed.R.Civ.P. II. Under this rule a pleading may not be “interposed for any improper purpose, such as to harass or to cause unnecessary delay or needless increase in the cost of litigation.” If a pleading is so interposed the court may award “reasonable expenses incurred because of the filing of the pleading, ... including a reasonable attorney’s fee.”

Judge Schwartz found in Cook II that Cook had filed the action “not to vindicate rights but to multiply proceedings and to put defendants and the courts to needless efforts and expense,” and with the purpose of “vexing, harassing and impeding the defendants in the proper performance of their duties under the law.” Judge Ramirez, likewise, found in Cook III that Cook had filed the lawsuit in “bad faith” and for “vexatious purposes.” He stated that the lawsuit “is a carbon copy of Cook’s previous lawsuits, raising the identical cause of action, Cook’s adding of new defendants in this lawsuit is an unjustified reprisal against officers of the court and other officials for lawfully exercising their constitutional and statutory duties during the pendency of Cook’s previous actions.”

In Callow v. Amerace Corp., 681 F.2d 1242, 1243 (9th Cir.1982), this court affirmed an award of attorney fees as “an appropriate deterrent to future frivolous suits,” concluding that the express finding that Callow acted in bad faith was supported by the record and not clearly erroneous. See also Press v. McNeal, 568 F.Supp. 256, 260 (E.D.Pa.1983). The award of attorney fees was proper in both cases.

We have considered Cook’s other related contentions and find them without merit.

VI. Conclusion

We affirm the judgment of dismissal entered by the district court in Cook II, together with the orders enjoining Cook from relitigating or attempting to relitigate the factual and legal issues adjudicated and dismissed in Cook II, the releases of all liens against defendants’ property, the assessment of costs, and award of attorney fees. We affirm the judgment of dismissal entered in Cook III, together with those portions of the orders enjoining the relit-igation of the issues in Cook II, assessing costs, and awarding attorney fees, but reverse those portions of the order enjoining the relitigation of the issues in Cook I and Cook III. We conclude that Cook did not appeal that portion of the order in Cook III expunging the liens against defendants’ property.

AFFIRMED IN PART AND REVERSED IN PART. 
      
      . Cook instituted three suits. This appeal involves the second (Cook II) and third (Cook III) actions.
     
      
      . In Cook II Judge Schwartz ordered a release of all present and future liens. In Cook III, Judge Ramirez actually enjoined Cook from filing such liens.
     
      
      . Because Judge Ramirez found the action frivolous, he dismissed with prejudice.
     
      
      . As noted above, in each case, following the entry of judgment, Cook stipulated that he would release the liens from Meuwissen’s property and that he would refrain from filing such liens on the property of all federal defendants.
     
      
      . In denying the motion to vacate the order of dismissal Judge Schwartz concluded that there was ample authority to dismiss the action for lack of subject matter on the ground of insub-stantiality. He did not, however, dismiss the action on this ground. See discussion of "sub-stantiality doctrine” under Cook III.
     
      
      . The court noted in Wood that, "The doctrine of collateral estoppel and res judicata ordinarily provide adequate assurance that one court's resolution of a controversy will be respected by other courts.” The court continued: "Nevertheless, under the All Writs Act, 28 U.S.C. § 1651, district courts do have the power to reinforce the effects of these doctrines by issuing an injunction against repetitive litigation. (Citing 
        Clinton v. United States, 297 F.2d 899 (9th Cir.1961)).” Id. at 1524.
     
      
      . Because Cook asserted a federal question, jurisdiction was facially conferred, thus allowing Judge Ramirez to apply the substantiality doctrine. See Hagans, 415 U.S. at 538-39, 94 S.Ct. at 1379-80.
     
      
      . The formal judgment simply stated that judgment was entered for the defendants. In Judge Ramirez's order he stated that defendants’ motions were granted "for lack of subject matter jurisdiction and for failure to state a claim upon which relief can be granted.” Earlier in his order he stated that the defendants’ various grounds for dismissal were well taken, but "it will not be necessary to base my judgment” on these grounds of defense and that he found .“that this lawsuit is wholly frivolous, insubstantial and groundless. It thus is outside this court’s subject matter jurisdiction.” In a colloquy with Cook at a hearing on a motion filed by Cook subsequent to the judgment, Judge Ramirez said in part:
     
      
      . The brief of the county appellees reads in part: "Mr. COOK, in his Opening Brief, identifies two items (items 6 and 7 of his Statement of Issues) as stipulated matters which he claims are not in issue on appeal. These items are not in issue only because Mr. COOK has elected to abide by the order of the District Court, and not to appeal these issues to the Ninth Circuit Court of Appeal. There is no stipulation on these issues, but there is an order of the District Court directing the dismissal of the case and that liens filed by Mr. COOK shall be without force or effect, and shall be removed.”
     
      
      . Rule 11 was amended on April 18, 1983, to include sanctions, following the decision of the Supreme Court in Roadway Express, Inc. v. Piper, 447 U.S. 752, 766-67, 100 S.Ct. 2455, 2464, 65 L.Ed.2d 488 (1980). The Notes of the Advisory Committee state that the amended rule attempts to expand "the equitable doctrine permitting the court to award expenses, including attorney’s fees, to a litigant whose opponent acts in bad faith in instituting or conducting litigation.” (Citing Roadway Express).
      
     
      
      . In Callow, the plaintiff claimed that reserve notes were not valid money, a claim which had been rejected by every court considering the claim. Id. at 1243.
     
      
      . It may be noted that in view of Cook’s financial situation each court awarded a very modest fee — $500.00 to each of the three groups of defendants and $500.00 to the United States.
     
      
      . In Wood, as here, the plaintiff was a pro se litigant. We have given due consideration to this fact, as the court did in Wood, 705 F.2d at 1525.
     
      
      . We recognize that this partial reversal will have no practical effect, since the same issues were raised in Cook I and III as in Cook II, and we are affirming the orders with respect to Cook II.
     