1 Kings 8:31-53 ESV
“If a man sins against his neighbor and is made to take an oath and comes and swears his oath before your altar in this house, then hear in heaven and act and judge your servants, condemning the guilty by bringing his conduct on his own head, and vindicating the righteous by rewarding him according to his righteousness.
“When your people Israel are defeated before the enemy because they have sinned against you, and if they turn again to you and acknowledge your name and pray and plead with you in this house, then hear in heaven and forgive the sin of your people Israel and bring them again to the land that you gave to their fathers.
“When heaven is shut up and there is no rain because they have sinned against you, if they pray toward this place and acknowledge your name and turn from their sin, when you afflict them, then hear in heaven and forgive the sin of your servants, your people Israel, when you teach them the good way in which they should walk, and grant rain upon your land, which you have given to your people as an inheritance.
“If there is famine in the land, if there is pestilence or blight or mildew or locust or caterpillar, if their enemy besieges them in the land at their gates, whatever plague, whatever sickness there is, whatever prayer, whatever plea is made by any man or by all your people Israel, each knowing the affliction of his own heart and stretching out his hands toward this house, then hear in heaven your dwelling place and forgive and act and render to each whose heart you know, according to all his ways (for you, you only, know the hearts of all the children of mankind), that they may fear you all the days that they live in the land that you gave to our fathers.
“Likewise, when a foreigner, who is not of your people Israel, comes from a far country for your name’s sake (for they shall hear of your great name and your mighty hand, and of your outstretched arm), when he comes and prays toward this house, hear in heaven your dwelling place and do according to all for which the foreigner calls to you, in order that all the peoples of the earth may know your name and fear you, as do your people Israel, and that they may know that this house that I have built is called by your name.
“If your people go out to battle against their enemy, by whatever way you shall send them, and they pray to the LORD toward the city that you have chosen and the house that I have built for your name, then hear in heaven their prayer and their plea, and maintain their cause.
“If they sin against you—for there is no one who does not sin—and you are angry with them and give them to an enemy, so that they are carried away captive to the land of the enemy, far off or near, yet if they turn their heart in the land to which they have been carried captive, and repent and plead with you in the land of their captors, saying, ‘We have sinned and have acted perversely and wickedly,’ if they repent with all their heart and with all their soul in the land of their enemies, who carried them captive, and pray to you toward their land, which you gave to their fathers, the city that you have chosen, and the house that I have built for your name, then hear in heaven your dwelling place their prayer and their plea, and maintain their cause and forgive your people who have sinned against you, and all their transgressions that they have committed against you, and grant them compassion in the sight of those who carried them captive, that they may have compassion on them (for they are your people, and your heritage, which you brought out of Egypt, from the midst of the iron furnace). Let your eyes be open to the plea of your servant and to the plea of your people Israel, giving ear to them whenever they call to you. For you separated them from among all the peoples of the earth to be your heritage, as you declared through Moses your servant, when you brought our fathers out of Egypt, O Lord GOD.”
ESV: English Standard Version 2016