The environment of a mobile ad hoc network may vary greatly depending on nodes' mobility, traffic load and resource conditions. In this paper we categorize the environment of an ad hoc network into three main states: an ideal state, wherein the network is relatively stable with sufficient resources; a congested state, wherein some nodes, regions or the network is experiencing congestion; and an energy critical state, wherein the energy capacity of nodes in the network is critically low. Each of these states requires unique routing schemes, but existing ad hoc routing protocols are only effective in one of these states. This implies that when the network enters into any other states, these protocols run into a sub optimal mode, degrading the performance of the network. We propose an Ad hoc Network State Aware Routing Protocol (ANSAR) which conditionally switches between earliest arrival scheme and a joint Load-Energy aware scheme depending on the current state of the network. Comparing to existing schemes, it yields higher efficiency and reliability as shown in our simulation results.