It is said that the city of Qom existed in the pre-Islamic ages, whereas, some believe that the same belongs to the post Islamic times. "Kom" was the name of the ancient rampart of the city of Qom, thus, the Arabs called it Qom (or Ghom).
During the Arab conquests in Iran, Qom was a district of Esfahan and thereby was captured along with the same. In the year 23-24 AH., Abu Moosa Ashari, dispatched a part of the forces under his command to Qom. It was during the reign of Caliph Omar II, that Qom was captured by the Moslems, and was turned into a city due to migration of the Ashari tribe from Kufeh. Conflicts arose between the new arrivals (Arabs) and the former residents of the area being the Zoroastrians. Finally the invaders gained a strong hold. From the early Islamic period, the Alavians flocked to Qom so as to remain free of pursuit from the dominating Abbasside and Omavi rulers. Due to presence of the Alavians here, this city became their seat.
The people held Ma'moon responsible for the assassination of the eighth Imam of the Shiite sect, Imam Ali Ebne Moos-al-Reza (PBUH), and have great respect for the Imam's sibling who passed away in Qom and was laid to rest in that very city, in the year 201 AH. This brought about differences between the inhabitants and the ruler of the times, and people evaded taxes. This prompted Ma'moon to send forces to Qom in the year 210 AH., which resulted in a public massacre and destruction of the city.
On hearing of the demise of Ma'moon, the inhabitants of Qom revolted and were successful in overthrowing the representative of the Caliph in 216 AH. Ma'moon's successor dispatched forces to Qom in order to curb the riots and once again the city was set aflame. After which, 'Mohammad Ebne Issa Ba'ad Qesi' was assigned as the ruler of Qom, and he followed a tactful policy.
With the oncoming of the Abbassids, the anti-Alavi policy strengthened, and the inhabitants of Qom gave full support to 'Hassan Kokabi' till the Alavian rule dominated in the limits of Taleqan, Qazvin, Zanjan and Abhar. In the year 254 AH., the Abbassid Caliph of the time assigned 'Moosa Ebne Baqa' to curb Hassan Kokabi and the revolts of Qom. The inhabitants appealed to the eleventh Imam of the Shiite sect, Imam Hassan Asger (PBUH) in order to be freed from the hands of the despotic caliphs and their agents. The unrest continued right till the Al Booyeh came to power, being one of the Alavian community. It was during this reign that the city of Qom expanded and thrived. In the Saljuqi era the city flourished too. During the Mongol invasion the city witnessed destruction, but after Mongol rulers, such as 'Soltan Mohammad Oljaito' adhered to Islam, the city received special attention, thus reviving again. In the late 8th century AH., the city came under the plunder of 'Teimoor Gurkani' when the inhabitants were massacred again. During the periods of the rule of the 'Qarah Qoyoonloo', 'Aq Qoyoonloo', and specially during the reign of the Safavids, Qom gained special attention and gradually developed. In the year 909 AH., Qom became one of the important centers of theology in relation to the Shiite sect, and was a vital pilgrimage site and religious pivot. During the Afghan invasion, the city of Ghom suffered heavy damages, and its inhabitants witnessed economic pressures.
Qom (Ghom) further saw severe damages during the reigns of Nader Shah Afshar, and the conflicts between the two households of Zandieh and Qajar in order to gain power in Iran.
In the year 1208 AH., Qom came under the control of Aqa Mohammad Khan Qajar. On being victorious over his enemies, Fath Ali Shah was responsible for the repairs done on the sepulchre and Holy Shrine of Hazrat Ma'soomeh (AS), as he had made such a vow.
The city of Ghom thrived in the Qajar era. After the Russian forces entered Karaj in 1915, many of the inhabitants of Tehran moved to Qom. The transfer of the capital from Tehran to Qom was discussed. But the British and Russians demolished the plan by bringing the monarch of the times, Ahmad Shah under pressure. Coinciding with this period, a 'National Defense Committee' was set up, and Qom turned into a political and military apex, against the Russian and British powers. But after innumerable differences, came under the hold of the Russian forces in the year 1915. Today, Qom is counted as one of the focal centers of the Shiite sect both in Iran and round the globe.
Its theological center and the Holy Shrine of Hazrat Ma'soomeh (AS) are prominent features of this flourishing city.