Al-Fuḍayl ibn ʿIyāḍ said, “To leave off a deed on account of the people is ostentation, and to perform a deed for the people is an act of shirk (associating partners with Allah). Performing it in the very place where one earns his livelihood—which he relies on to assist him in worshipping Allah—is better for him than doing it in a location where his means of living would be suspended and his heart distracted on that account; for the more focused the heart is in prayer and the farther it is from whisperings, the more perfect the prayer becomes.
Whoever forbids a legitimate practice solely on the claim that it is ostentation, his objection is rejected on several grounds:
First: prescribed acts are not to be abandoned out of fear of ostentation; rather, one is commanded to perform them and to be sincere within them. Whenever we see someone carrying them out, we affirm him even if we were certain that he is doing so to show off. The hypocrites about whom Allah says,
“The hypocrites seek to deceive Allah, but He is deceiving them; when they rise for the prayer they rise lazily, showing off to the people, and they remember Allah only a little” (al-Nisāʾ: 142),
were still acknowledged by the Prophet—may Allah bless him and grant him peace—and the Muslims for the outward religious observances they displayed, even though they were showing off. They were not told to abandon the outward act, because the harm of neglecting a prescribed duty is greater than the harm of performing it for show—just as the harm of concealing one’s faith