The verse  Lev melech beyad hashem refers to a step in which you have no  bechira: After the  nomination of the  King,  we need to see  every action of the  king  as  a realization of the  intent of HaShem. [see Rabenu Yona on Avot 2, 3] [02]

But in a previous step,  before the election,  this vision is erroneous.  If a candidate "A"  says "I will make  an action "f"  and you  disapprove this  action,  you must see your duty  ad a duty to  act against "A".  If  "A"  b es come president because of your lack of opposition,  you may be  regarded as  a shutaf of the  action "f",   as the famous expression: פרתו של רבי אלעזר בן עזריה in Mishna betsa (2, 8) and Shabbat (5, 4). 


[02]: 
http://www.sefaria.org/Pirkei_Avot.2.3?with=Rabbeinu%20Yonah&lang=he