Jehoshaphat was the son and successor of Asa, becoming fourth king of Judah. After fortifying his kingdom against Israel, he followed in his father's footsteps by attempting to cleanse the land of idolatry. He sent out priests and Levites to instruct the people in the law as well as administer it.
However, for unexplained reasons, he aligned himself with Ahab, King of Israel, and his vile wife Jezebel, even accepting Ahab's daughter Athaliah as a wife for his son Jehoram. This alliance brought disgrace upon him and disaster upon his kingdom, but this was preceded by an act that nearly got Jehoshaphat killed.
During a meeting between the two kings, Ahab expressed his desire to recover territories taken from him by Syria. Jehoshaphat agreed to join him in this venture, on the condition that they first seek God's approval. He didn't receive it, but Ahab, nevertheless persuaded Jehosphat to join him.
So the king of Israel and Jehoshaphat king of Judah went up to Ramoth Gilead. The king of Israel said to Jehoshaphat, "I will enter the battle in disguise, but you wear your royal robes." So the king of Israel disguised himself and went into battle.
Now the king of Aram had ordered his thirty-two chariot commanders, "Do not fight with anyone, small or great, except the king of Israel." When the chariot commanders saw Jehoshaphat, they thought, "Surely this is the king of Israel." So they turned to attack him, but when Jehoshaphat cried out, the chariot commanders saw that he was not the king of Israel and stopped pursuing him.
(1 Kings 22:29-33)
Ahab was killed by a random arrow, and retreated to die near his palace at Jezreel. After his death Jehoshaphat formed an alliance with his son and successor Ahaziah. They built a fleet of ships together intending to embark on international shipping trade. However Ahaziah, like Ahab, was wholeheartedly committed to evil, and God found the alliance repugnant. He sent a prophet to Jehoshaphat warning him if he went ahead with the alliance. This time Jehoshaphat obeyed.
The last notable event of Jehoshaphat's reign occured in a battle against the pagan Moabites. The Moabites formed a great and powerful army and came against Jehoshaphat, who was encamped at Engedi with his forces and the forces of the King of Edom and the King of Israel. The soldiers were dying of thirst, having run out of water during their journey through the desert. Jehoshaphat sought the help of the prophet Elisha who told him to dig ditches.
The next morning a flood ran through the valley, filling the ditches with water. Not only were the armies saved from death by dehydration, when the Moabites looked out over the valley the water-filled ditches looked like blood-covered fields in the early morning light. Concluding that the three armies had quarreled and slaughtered each other, they ran unarmed into Israel's camp to collect the plunder, and were routed.
Jehoshaphat died soon after this aged sixty. He had reigned for twenty-five years. He was succeeded by his son Jehoram.