A Turkish court has handed down a political ban to Istanbul Mayor Ekrem Imamoglu, the main political rival of President Recep Tayyip Erdogan, paving the way for the ruling party to take control of Turkey's largest city.