A federal judge broke a rule when, on her own, she ordered a lawyer to pay a $25,000 attorney fee as a penalty for taking a meritless case to trial, an appeals court has ruled.

Attorney fees can be awarded only on a motion of a party under Rule 11 of the Federal Rules of Civil Procedure, according to an April 22 ruling by a panel of the U.S. Court of Appeals for the 2d Circuit, in New York. The rule says that lawyers face sanctions if they don’t inquire into the viability of a pleading before signing it.