Ma Tovu (Hebrew for "O How Good" or "How Goodly") is a prayer in Judaism, expressing reverence and awe for synagogues and other places of worship.
The prayer begins with Numbers 24:5, where Balaam, sent to curse the Israelites, is instead overcome with awe at God and the Israelites' houses of worship. Its first line of praise is a quote of Balaam's blessing and is thus the only prayer commonly used in Jewish services that was written by a non-Jew. The remainder of the text is derived from passages in Psalms relating to entering the house of worship and preparation for further prayer (Psalms 5:8; 26:8; 95:6; and 69:14). In this vein is the prayer recited by Jews upon entering the synagogue.
מה טבו אהליך יעקב, משכנותיך ישראל. (1 Numbers 24:5
ואני ברב חסדך אבוא ביתך אשתחוה אל היכל קדשך ביראתך. (2 Psalms 5:7
3) .ה׳ אהבתי מעון ביתך, ומקום משכן כבודך Psalms 26:8
ואני אשתחוה ואכרעה, אברכה לפני ה׳ עשי. (4 Psalms 95:6 (adapted)
5) .ואני, תפלתי לך ה׳, עת רצון, אלהים ברב חסדך, ענני באמת ישעך Psalms 69:14