Complex sentence: He was his faction's unsuccessful candidate for the papacy in 896; when Pope John IX (898--900) was elected instead, he excommunicated Sergius III, who had to withdraw from his see at Cerveteri for safety.
Split into simpler sentences: He was his faction's unsuccessful candidate for the papacy in 896. When Pope John IX (898--900) was elected instead, he excommunicated Sergius, who had to withdraw from his see at Cerveteri for safety.