The nightmare scenario of a government dominated by a nationalist-religious coalition has been averted.