Medieval Islamic writers believed that the name “Samarra” is derived from the Arabic phrase, “Sarr min ra’a” "سر من رأى" which translates to “A joy for all who see”.
Though the present archaeological site covered by mudbrick ruins is vast, the site of Samarra was only lightly occupied in ancient times, apart from the Chalcolithic Samarran Culture (ca 5500–4800 BC) identified at the rich site of Tell Sawwan, where evidence of irrigation—including flax— establishes the presence of a prosperous settled culture with a highly organized social structure. The culture is primarily known by its finely-made pottery decorated against dark-fired backgrounds with stylized figures of animals and birds and geometric designs. This widely-exported type of pottery, one of the first widespread, relatively uniform pottery styles in the Ancient Near East, was first recognized at Samarra. The Samarran Culture was the precursor to the Mesopotamian culture of the Ubaid period.
A city of Sur-marrati, refounded by Sennacherib in 690 BC according to a stele in the Walters Art Gallery, Baltimore, is insecurely identified with a fortified Assyrian site of Assyrian at al-Huwaysh, on the Tigris opposite to modern Samarra.
Ancient toponyms for Samarra noted by the Samarra Archaeological Survey are: Greek: Souma (Ptolemy V.19, Zosimus III, 30), Latin: Sumere, a fort mentioned during the retreat of the army of Julian the Apostate in 364 AD (Ammianus Marcellinus XXV, 6, 4), and Syriac Sumra (Hoffmann, Auszüge, 188; Michael the Syrian, III, 88), described as a village.
The possibility of a larger population was offered by the opening of the Qatul al-Kisrawi, the northern extension of the Nahrawan canal which drew water from the Tigris in the region of Samarra, attributed by Yaqut (Mu`jam see under "Qatul") to the Sassanid king Khosrau I Anushirvan (531–578). To celebrate the completion of this project, a commemorative tower (modern Burj al-Qa'im) was built at the southern inlet south of Samarra, and a palace with a "paradise" or walled hunting park was constructed at the northern inlet (modern Nahr al-Rasasi) near to al-Daur. A supplementary canal, the Qatul Abi al-Jund, excavated by the Abbasid Caliph Harun al-Rashid, was commemorated by a planned city laid out in the form of a regular octagon (modern Husn al-Qadisiyya), called al-Mubarak and abandoned unfinished in 796.
In 836 the Abbasid caliphate's Turkic and Armenian slave soldiers -known as Mamluk- agitated the citizens of Baghdad, provoking riots. The capital of the Caliphate was moved from Baghdad to the new city of Samarra later that year by Caliph Al-Mu'tasim.
During this time the original pre-Islamic settlement was replaced with a new city established in 833. Samara would remain the capital of the Muslim world until 892 when it was returned to Baghdad by al-Mu'tamid. Al-Mu'tasim's successor, al-Wathiq, developed Samara into a commercial city, and it was further developed under Caliph Al-Mutawakkil.
The latter sponsored the construction of the Great Mosque of Samarra with its spiral minaret or malwiyah, built in 847. He also laid out parks and a palace for his son Al-Mu'tazz. Under the rule of Al-Mu'tadid, the Abbassid capital was shifted back to Baghdad and Samarra entered a prolonged decline, which accelerated after the 13th century when the course of the Tigris shifted.
The city is also home to the Al-Askari Mosque, containing the mausoleums of the Ali al-Hadi and Hasan al-Askari, the tenth and eleventh Shia Imams, respectively, as well as the shrine of Muhammad al-Mahdi, known as the "Hidden Imam", who is the twelfth and final Imam of the Shia of the Ja'farī Madhhab. This has made it an important pilgrimage centre for Ja'farī Shia Muslims. In addition, Hakimah Khatun and Narjis Khatun, female relatives of the Prophet Mohammed and the Shia Imams, held in high esteem by Shia and Sunni Muslims, are buried there, making this mosque one of the most significant sites of worship for Shia and a venerated location for Sunni Muslims. The people of Samarra belong to tribes that are known to descendents of Al-Hussein (son of Ali). While the vast majority of Samarra's native citizens are Sunnis and the Sunnis do not share the same religious practices that the Ja'farī Madhhab Shia of Iraq do, they consider these to be the grave sites of their forefathers and the pillars of Islam (Ali Al-Hadi and Hasan Al-Askari). Sunnis have been respectful and very protective of their ancestors and the mosques that are their mausoleums.
The Sunnis also pray in the mosques similar to the Shiites; they also (even as far as from South Asia) conduct pilgrimages to these sites, but they do not believe this to be obligatory, simply an affair of spiritual blessings.
Samarra is a key city in Salahuddin province, a major part of the so-called Sunni Triangle where insurgents have been active since shortly after 2003 invasion by the United States of America. Though Samarra is famous as a site of Shi'a holy sites, including the tombs of several Shi'a Imams, the town is dominated by Sunnis. This has caused tensions, particularly since the 2003 invasion of Iraq. On February 22, 2006, the golden dome of the Al Askari Mosque was destroyed by bombs, setting off a period of rioting and reprisal attacks across the country which claimed hundreds of lives. No organizations have claimed responsibility, however it is believed that the Mujahideen Shura Council, or groups sympathetic to its cause, were behind the attack.
On June 13, 2007, suspected al-Qaeda insurgents attacked the mosque again and destroyed the two minarets that flanked the dome's ruins. On July 12th, 2007, the clock tower was blown up. No fatalities were reported. Shiite cleric Muqtada al-Sadr called for peaceful demonstrations and three days of mourning. He stated that he believed no Sunni Arab could have been behind the attack. The mosque compound and minarets had been closed since the 2006 bombing. An indefinite curfew was placed on the city by the Iraqi police.
For centuries, people from the seven tribes of Samarra have guarded the shrine. These guards are called "gayaameen" in Arabic. According to gayaameen from the Darraji tribe of samarra, a few hours prior to the first bombing that occurred, ICDC troops (Iraqi Civil Defence Corps) accompanied by coalition troops, temporarily relieved the gayaameen of their duty. As a result of the bombings coinciding with the duty relief of the gayaameen just prior to the bombing, skepticism grew as to what level of involvement the ICDC or coalition troops had in the tragic event. Prior to the second bombing, the gayaameen were also relieved, except this time it was done by Internal Ministry officers (AKA: Maghaweer al-dakhiliah) accompanied by coalition troops. The gayaameen this time were instructed to move to the bridge that connects Samarra proper with the Gal'a (explanation needed) and establish a check point there. Soon after, the bombings occurred, destroying the shrine for a second time.