A petard was a small bomb used to blow up gates and walls when breaching fortifications. The term has a French origin and dates back to the XVI century. In a typical implementation, it was commonly either a conical or rectangular metal object containing 5 or 6 pounds of gun powder, activated with a slow match used as a fuse.
It was often placed either inside tunnels under walls, or directly upon gates. When placed inside a tunnel under a wall and exploded, large amounts of air would often be released from the tunnel, as the tunnel collapsed. By securing the device firmly to the gate, the shape of the device allows the concussive pressure of the blast to be applied entirely towards the destruction of the gate. Depending on design, a petard could be secured by propping it against the gate using beams as illustrated, or nailing it in place by way of a wooden board fixed to the end of the petard in advance.
A petard mortar was the demolition weapon fitted to the Churchill AVRE tank. It was a mortar of a 290 mm bore, known to its crews as the "flying dustbin" due to the characteristics of its projectile: an unaerodynamic 20 kg charge, sufficient to demolish many bunkers and earthworks and even disable a Tiger tank, which could be fired up to 100 m.
In Maltese English, home-made fireworks are called petards (the word in Maltese, murtal, is obviously related to "mortar"). In Malta, petards are detonated by the dozen during feasts dedicated to local patron saints.
Etymology: Middle French, from peter, to break wind, from pet expulsion of intestinal gas, from Latin peditum, from neuter of peditus, past participle of pedere, to break wind; akin to Greek bdein to break wind. (Merriam-Webster) Petard remains a French word meaning a firecracker today (in French slang, it means a handgun, or a joint).
The word remains in modern usage in the phrase to be hoist by one's own petard (or to be hoist with one's own petard), which means "to be harmed by one's own plan to harm someone else" or "to fall in one's own trap", literally implying that one could be lifted up (hoisted, or blown upward) by one's own bomb. Shakespeare used the now proverbial phrase in Hamlet.
In the following passage, the "letters" refer to instructions (written by his uncle Claudius, the King) to be carried sealed to the King of England, by Hamlet, Rosencrantz and Guildenstern, the latter being two schoolfellows of Hamlet. The letters, as Hamlet suspects, contain a death warrant against Hamlet, who will later open and modify them to instead request the execution of Rosencrantz and Guildenstern. Enginer refers to a military engineer, the spelling reflecting Elizabethan stress.
After modifying the letters Hamlet escapes the ship and returns to Denmark.
In medieval and Renaissance siege warfare, a common tactic was to dig a shallow trench close to the enemy gate, and then erect a small hoisting engine that would lift the lit petard out of the trench, swing it up, out, and over to the gate, where it would detonate and hopefully breach the gate. It was not impossible, however, that this procedure would go awry, and the engineer lighting the bomb could be snagged in the ropes and lifted out with the petard and consequently blown up. Alternately, and perhaps a more likely scenario, if the petard were to detonate prematurely due to a faulty or short slow match, the engineer would be lifted or 'hoist' by the explosion.
Thus to be 'hoist with his own petar' is to be caught up and destroyed by his own plot. Hamlet's actual meaning is "cause the bomb maker to be blown up with his own bomb", metaphorically turning the tables on Claudius, whose messengers are killed instead of Hamlet. Also note here, Shakespeare's probable off-color pun "hoisted with his own petar" (i.e., fart) as reason for the spelling "petar" rather than "petard".