VORONIN served as Moldova 's president until he resigned in September 2009 , following the opposition 's gain of a narrow majority in July parliamentary elections and the Communist Party 's ( PCRM ) subsequent inability to attract the three-fifths of parliamentary votes required to elect a president .