  We prove a system of relations in the Grothendieck ring of the category O of
representations of the Borel subalgebra of an untwisted quantum affine algebra
U_q(g^) introduced in [HJ]. This system was discovered in [MRV1, MRV2], where
it was shown that solutions of this system can be attached to certain affine
opers for the Langlands dual affine Kac-Moody algebra of g^, introduced in
[FF5]. Together with the results of [BLZ3, BHK], which enable one to associate
quantum g^-KdV Hamiltonians to representations from the category O, this
provides strong evidence for the conjecture of [FF5] linking the spectra of
quantum g^-KdV Hamiltonians and affine opers for the Langlands dual affine
algebra. As a bonus, we obtain a direct and uniform proof of the Bethe Ansatz
equations for a large class of quantum integrable models associated to
arbitrary untwisted quantum affine algebras, under a mild genericity condition.
We also conjecture analogues of these results for the twisted quantum affine
algebras and elucidate the notion of opers for twisted affine algebras, making
a connection to twisted opers introduced in [FG].
