Turkish police have faced off with thousands of pro-opposition protesters demonstrating against the outcome of local elections in the major cities of Istanbul and Ankara.