Svatopluk also agreed to lead Carloman's armies against Slavomír and the rebellious Moravians. However, on his arrival at "Rastislav's old city", Svatopluk betrayed the Bavarians and conspired secretly with the rebels. Although he captured the fortress in accordance with Carloman's plan, once he was inside its walls he renounced his loyalty to Carloman, rallied a large Moravian force and launched a devastating surprise attack on the unsuspecting Bavarian army encamped outside. The Moravians took a great number of soldiers hostage, killed the rest and rid Moravia of the Frankish occupation. Carloman's governors, William and Engelschalk, were also both slain, and Svatopluk became the undisputed ruler of Great Moravia.