Swedish Prime Minister Stefan Lofven lost a no-confidence vote in parliament on Tuesday and will step down after four years in power.