A co-founder of the terror group Hamas died Tuesday, three weeks after accidentally shooting himself in the face while cleaning his weapon, an official said.

Imad al-Alami, 62, was “examining his personal weapon in his home” Jan. 9 when the gun went off and a bullet struck him in the face, Hamas said.

He had been hospitalized in Gaza until his death, according to the Jerusalem Post.

Hamas initially announced al-Alami died of natural causes, dispelling rumors he'd committed suicide or was murdered. However, the group later admitted an accident had actually caused al-Alami's death.

Al-Alami held several key posts as a member of Hamas’ policy-making body and lived in Syria until 2012. He remained a top-ranking official, though not a member of the militant outfit's current staff.

After the 2014 Israel-Hamas war, al-Alami traveled to Turkey for treatment for an injury in which he lost a leg. Hamas said he was wounded in the war.

The Associated Press contributed to this report.