In an effort to salvage the monarchy, João Franco stepped down as prime minister and went into exile. New elections were held, but factionalism among the Regenerators and Historicals prevented the formation of a stable government even after six attempts. On October 1, 1910, the appearance in Portugal of the president of the Brazilian republic after a visit to Germany provided a pretext for extensive republican demonstrations. On October 3, the army refused to put down a mutiny on Portuguese warships anchored in the estuary of the Tagus and took up positions around Lisbon. On October 4, when two of the warships began to shell the royal palace, Manuel II and the royal family fled to Britain. On October 5, a provisional republican government was organized with the writer Teófilo Braga as president.