Thousands of moderates were barred from standing, with the outcome likely to weaken the president.