In the framework of a variational method with a single trial function an accurate study of the lowest gerade 1 _ { g } and ungerade 1 _ { u } electronic states of the molecular ion H _ { 2 } ^ { + } in a magnetic field is performed . Magnetic field ranges from 0 to 4.414 \times 10 ^ { 13 } G and orientations of the molecular axis with respect to the magnetic line 0 ^ { \circ } \leq \theta \leq 90 ^ { \circ } are considered . A one-parameter gauge dependent vector potential is used in the Hamiltonian , which is finally variationally optimized . A well pronounced minimum on the total energy surface of the ( ppe ) system in both 1 _ { g } and 1 _ { u } states is found for all magnetic fields and orientations studied . It is shown that for both states the parallel configuration ( \theta = 0 ) at equilibrium always corresponds to the minimal total energy . It is found that for a given \theta for both states the magnetic field growth is always accompanied by an increase in the total and binding energies as well as a shrinking of the equilibrium distance . We demonstrate that for B \gtrsim 1.8 \times 10 ^ { 11 } G the molecular ion can dissociate , H _ { 2 } ^ { + } \rightarrow H + p , over a certain range of orientations ( \theta _ { cr } \leq \theta \leq 90 ^ { \circ } ) , where the minimal \theta _ { cr } \simeq 25 ^ { \circ } occurs for the strongest magnetic field studied , B = 4.414 \times 10 ^ { 13 } G. For B < 10 ^ { 12 } G the ion H _ { 2 } ^ { + } in 1 _ { g } , 1 _ { u } states is the most compact , being in the perpendicular configuration ( \theta =90 ^ { \circ } ) , whereas for B \gtrsim 10 ^ { 12 } this occurs for an angle < 90 ^ { \circ } . For the 1 _ { g } state in any orientation , with the magnetic field growth at B \sim 10 ^ { 11 } G , a two-peak electronic distribution changes to single-peak one .