There is nothing wrong, as far as Islam is concerned, in placing the American flag on top of Islamic centers and Mosques in the States in a show of declaring loyalty to the country where Muslims reside. It is reported that Muslims used to carry flags and hand them to one another during wars. Also, each Muslim tribe used to have a distinctive flag of its own.
Thus, placing such flags is no more than a symbol of showing loyalty, and it has nothing to do with Islamic creed. It is worthy mentioning here that all new things that does not run counter to the teachings of Islam are permitted for Muslims even though such things are not mentioned in the Islamic legacy.
Sheikh Ahmad Kutty, A Senior Lecturer and an Islamic Scholar at the Islamic Institute of Toronto, Ontario, Canada, adds:
It is permissible for Muslims living in the United States to place the American Flag on the top of Islamic centers. American Muslims are citizens, who owe the duty of rising up to the standard of a loyal citizens and give regard to the dictate of the covenant they have made with the state. Islam requires us to be faithful to our contracts and covenants so long as they do not violate Islamic principles.
By being a citizen of the United States, you have not violated any of the principles of Islam so long as you have entered into this contract of citizenship with full consciousness of upholding what is true and right as Islam teaches us.
As a free citizen of the United States, you are not forced to suppress your beliefs and speak against conscience. Therefore, there is nothing wrong for us to express loyalty to the States by putting the flags over our institutions and Islamic centers. We must do so especially in time when our loyalty is being questioned."