In 2006, Hamas won a stunning victory in the Palestinian Legislative Council (PLC) elections, but tensions with the rival Fatah faction of Palestinian Authority President Mahmoud Abbas heightened.
Deadly clashes between Fatah and Hamas erupted in Gaza in June 2007, after which Hamas set up a rival government, leaving Fatah and the PA running parts of the West Bank not under Israeli control.
Israel held Hamas responsible for all attacks emanating from the Gaza Strip, and has carried out three major military campaigns in Gaza - Operation Cast Lead in December 2008, Operation Pillar of Defence in November 2012 and Operation Protective Edge in July 2014.
The offensives were preceded by escalations in cross-border fighting, with scores of rocket attacks from Gaza, and air strikes against it by Israel.
Hamas emerged from the 2008 and 2012 conflicts militarily degraded but with renewed support among Palestinians in Gaza and the West Bank for having confronted Israel and survived.
The group nevertheless continued to struggle under the joint blockade imposed on Gaza by Israel and Egypt, and became increasingly isolated after falling out with regional powers in the wake of the Arab Spring. The overthrow of Egyptian President Mohammed Morsi, a key ally, in July 2013 was a further blow.
In April 2014, Hamas agreed a reconciliation deal with Fatah that led to the formation a national unity government.