The preferential binding of anions and cations in aqueous solutions of the ionic liquids (ILs) 1-butyl-3-methylimidazolium ([C(4)mim](+)) and 1-ethyl-3-methylimidazolium ([C(2)mim](+)) chloride and dicyanamide (dca(-)) with the small alpha-helical protein Im7 was investigated using a combination of differential scanning calorimetry, NMR spectroscopy and molecular dynamics (MD) simulations. Our results show that direct ion interactions are crucial to understand the effects of ILs on the stability of proteins and that an anion effect is dominant. We show that the binding of weakly hydrated anions to positively charged or polar residues leads to the partial dehydration of the backbone groups, and is critical to control stability, explaining why dca(-) is more denaturing than Cl-. Direct cation-protein interactions also mediate stability; cation size and hydrophobicity are relevant to account for destabilisation as shown by the effect of [C(4)mim](+) compared to [C(2)mim](+). The specificity in the interaction of IL ions with protein residues established by weak favourable interactions is confirmed by NMR chemical shift perturbation, amide hydrogen exchange data and MD simulations. Differences in specificity are due to the balance of interaction established between ion pairs and ion-solvent that determine the type of residues affected. When the interaction of both cation and anion with the protein is strong the net result is similar to a non-specific interaction, leading ultimately to unfolding. Since the nature of the ions is a determinant of the level of interaction with the protein towards denaturation or stabilisation, ILs offer a unique possibility to modulate protein stabilisation or even folding events.