After publicly rejecting Mihailović, Šubašić met with Tito on the island of Vis and signed the Tito–Šubašić agreement, which recognised the Partisans as the legitimate armed forces of Yugoslavia in exchange for Partisans formally recognising and taking part in the new government. Šubašić kept his post until 7 March 1945, when Tito formally became the prime minister of Yugoslavia. Šubašić was foreign minister in his cabinet until October, when he resigned, disagreeing with Communist policies of new government.