If it wasn’t for its appearance in Shakespeare’s Hamlet: “For ‘tis the sport to have the enginer / Hoist with his owne petar” and its fossil survival in the rather more modern spelling to be hoist with one’s own petard, this term of warfare would have gone the way of the halberd, brattice and culverin.
A petard was a bell-shaped metal grenade typically filled with five or six pounds of gunpowder and set off by a fuse. Sappers dug a tunnel or covered trench up to a building and fixed the device to a door, barricade, drawbridge or the like to break it open. The bomb was held in place with a heavy beam called a madrier.
Unfortunately, the devices were unreliable and often went off unexpectedly. Hence the expression, where hoist meant to be lifted up, an understated description of the result of being blown up by your own bomb. The name of the device came from the Latin petar, to break wind, perhaps a sarcastic comment about the thin noise of a muffled explosion at the far end of an excavation.