Hamas is the largest of several Palestinian militant Islamist groups.
Its name is an Arabic acronym for the Islamic Resistance Movement, originating as it did in 1987 after the beginning of the first Palestinian intifada, or uprising, against Israel's occupation of the West Bank and Gaza Strip. Under its charter, it is committed to the destruction of Israel.
Hamas originally had a dual purpose of carrying out an armed struggle against Israel - led by its military wing, the Izzedine al-Qassam Brigades - and delivering social welfare programmes.
But since 2005, when Israel withdrew its troops and settlers from Gaza, Hamas has also engaged in the Palestinian political process. It won the legislative elections in 2006, before reinforcing its power in Gaza the following year by ousting the rival Fatah movement of President Mahmoud Abbas.
Since then, militants in Gaza have fought three wars with Israel, which along with Egypt has maintained a blockade on the strip to isolate Hamas and to pressure it to stop attacks.
Hamas as a whole, or in some cases its military wing, is designated a terrorist group by Israel, the United States, European Union and United Kingdom, as well as other powers.
Hamas came to prominence after the first intifada as the main Palestinian group opposed to peace accords signed in the early 1990s between Israel and the Palestine Liberation Organisation (PLO), the body representing most Palestinians.
Despite numerous Israeli operations against it and clampdowns by the Palestinian Authority (the main governing body of the Palestinians) Hamas found it had an effective power of veto over the process by launching suicide attacks.
In February and March 1996, it carried out several suicide bus bombings, killing nearly 60 Israelis, in retaliation for the assassination in December 1995 of Hamas bomb maker Yahya Ayyash.
The bombings were widely blamed for turning Israelis off the peace process and bringing Benjamin Netanyahu - a staunch opponent of the Oslo accords - to power that year.
In the post-Oslo world, most particularly following the failure of US President Bill Clinton's Camp David summit in 2000 and the second intifada which followed shortly thereafter, Hamas gained power and influence as Israel clamped down on the Palestinian Authority, which it accused of sponsoring deadly attacks.
Hamas organised clinics and schools, which served Palestinians who felt let down by the corrupt and inefficient Palestinian Authority, dominated by the Fatah faction.
Many Palestinians cheered the wave of Hamas suicide attacks in the first years of the second intifada. They saw "martyrdom" operations as avenging their own losses and Israel's settlement building in the West Bank, territory wanted by Palestinians as part of their own state.
In March and April 2004, Hamas spiritual leader Sheikh Ahmed Yassin and his successor Abdul Aziz al-Rantissi were assassinated in Israeli missile strikes in Gaza.
The death of Fatah leader Yasser Arafat that November saw the Palestinian Authority newly led by Mahmoud Abbas, who viewed Hamas rocket-fire as counter-productive.
When Hamas scored a landslide victory in Palestinian parliamentary elections in 2006, the stage was set for a bitter power-struggle with Fatah.
Hamas resisted all efforts to get it to sign up to previous Palestinian agreements with Israel, as well as to recognise Israel's legitimacy and to renounce violence.
The 1988 charter
Hamas's charter defines historic Palestine - including present-day Israel - as Islamic land and it rules out any permanent peace with the Jewish state.
The document also repeatedly makes attacks on Jews as a people, drawing charges that the movement is anti-Semitic.
In 2017, Hamas produced a new policy document that softened some of its stated positions and used more measured language.
There was no recognition of Israel, but it did formally accept the creation of an interim Palestinian state in Gaza, the West Bank and East Jerusalem - what are known as pre-1967 lines.
The document also stresses that Hamas's struggle is not with Jews but with "occupying Zionist aggressors". Israel said the group was "attempting to fool the world".
As a result, the new Hamas-led government was subjected to tough economic and diplomatic sanctions by Israel and its allies in the West.
After Hamas ousted forces loyal to Fatah from Gaza in 2007, Israel tightened its blockade on the territory, and Palestinian rocket-fire and Israeli air strikes continued.
Israel holds Hamas responsible for all attacks emanating from the strip, and has carried out three major military campaigns in Gaza that were preceded by escalations in cross-border fighting.
In December 2008, the Israeli military launched Operation Cast Lead to halt rocket attacks. More than 1,300 Palestinians and 13 Israelis were killed during the 22-day conflict.
Israel cited the same reason for launching Operation Pillar of Defence in November 2012, which began with an air strike that killed Ahmed Jabari, the commander of the Qassam Brigades. Some 170 Palestinians - mostly civilians - and six Israelis died in eight days of fighting.
Hamas emerged from both conflicts militarily degraded but with renewed support among Palestinians for having confronted Israel and survived.
Rocket-fire from Gaza increased once again in mid-June 2014 when Israel arrested many Hamas members across the West Bank while searching for three murdered Israeli teenagers.
In early July, Hamas claimed responsibility for firing rockets at Israel for the first time in two years. The following day, the Israeli military launched an offensive called Operation Protective Edge to destroy rockets and cross-border tunnels used by militants.
At least 2,251 Palestinians, including 1,462 civilians, were killed during the 50-day conflict. On the Israeli side, 67 soldiers and six civilians were killed.
Since 2014, there have been regular flare-ups of violence that have ended with ceasefires brokered by Egypt, Qatar and UN and not escalated into full-scale wars.
Despite the pressure of the blockade, Hamas has held on to power in Gaza and continued to improve its arsenal of rockets. Attempts at reconciliation with Fatah have also failed.
Meanwhile, the humanitarian situation for the two million Palestinians in Gaza has deteriorated. The strip's economy has collapsed, and there are shortages of water, electricity and medicine.