From Wikipedia, which may or may not be right:
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 sixteenth century.[1] In a typical implementation, it was commonly either a conical or rectangular metal object containing 2-3 kg (5 or 6 pounds) of gunpowder, activated with a slow match used as a fuse. . .
The word petard comes from the Middle French 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 marijuana cigarette).
The word remains in modern usage in the phrase hoist with one's own petard, which means "to be harmed by one's own plan to harm someone else" or "to fall into one's own trap," literally implying that one could be lifted up (hoist, or blown upward) by one's own bomb.
[edit]
Then I stand corrected. I should have looked that up and not relied upon that former teacher of mine for all these years. This is from another source:
pe·tard (p-tärd)
n.
1. A small bell-shaped bomb used to breach a gate or wall.
2. A loud firecracker.
[French pétard, from Old French, from peter, to break wind, from pet, a breaking of wind, from Latin pditum, from neuter past participle of pdere, to break wind; see pezd- in Indo-European roots.]
Word History: The French used pétard, "a loud discharge of intestinal gas," for a kind of infernal engine for blasting through the gates of a city. "To be hoist by one's own petard," a now proverbial phrase apparently originating with Shakespeare's Hamlet (around 1604) not long after the word entered English (around 1598), means "to blow oneself up with one's own bomb, be undone by one's own devices." The French noun pet, "fart," developed regularly from the Latin noun pditum, from the Indo-European root *pezd-, "fart."
The American Heritage® Dictionary of the English Language, Fourth Edition copyright ©2000 by Houghton Mifflin Company. Updated in 2009. Published by Houghton Mifflin Company. All rights reserved.