Answer:
He prayed to the god Apollo for guidance, and the god's oracle told him he would have to serve Eurystheus, the king of Tiryns and Mycenae, for twelve years, in punishment for the murders. As part of his sentence, Hercules had to perform twelve Labors, feats so difficult that they seemed impossible.