A false flag operation is an act committed with the intent of disguising the actual source of responsibility and pinning blame on another party.
The term "false flag" originated in the 16th century as a purely figurative expression to mean "a deliberate misrepresentation of someone's affiliation or motives". It was later used to describe a ruse in naval warfare whereby a vessel flew the flag of a neutral or enemy country in order to hide its true identity. The tactic was originally used by pirates and privateers to deceive other ships into allowing them to move closer before attacking them. It later was deemed an acceptable practice during naval warfare according to international maritime laws, provided the attacking vessel displayed its true flag once an attack had begun.
The term today extends to include countries that organize attacks on themselves and make the attacks appear to be by enemy nations or terrorists, thus giving the nation that was supposedly attacked a pretext for domestic repression and foreign military aggression.
Similarly deceptive activities carried out during peacetime by individuals or non governmental organizations can (by extension) also be called false flag operations, but the more common legal term is a "frameup", "stitch up", or "setup".