Swordfighting as a sport has existed since ancient Egypt, and has been practised in many forms in various cultures since then. Although jousting and tournament combat was a popular sport in the European Middle Ages, modern FIE fencing owes more to unarmoured duelling forms that evolved from 16th century rapier combat.
Although rapier combat had a nominal military role (for thrusting into the chinks of heavy armour), it was most popular amongst civilians who used it for self-defence and duelling. Rapiers were edged, but the primary means of attack was the thrust. Rapier fencing spread from Italy to Spain and North-West Europe, in spite of the objections of masters such as George Silver who preferred traditional cutting weapons such the English longsword.
The Spanish school, under masters such as Narvaez and Thibault, became a complicated and mystical affair whose geometrical theories required much practice to master. Italian masters such as Agrippa and Capo Ferro developed a more pragmatic school in the late 16th and early 17th centuries, introducing innovations such as linear fencing and the lunge.
By the 18th century, the rapier had evolved to a simpler, shorter, and lighter design that was popularized in France as the smallsword, or court sword. Although the smallsword often had an edge, it was only to discourage the opponent from grabbing the blade, and the weapon was used exclusively for thrusting. The light weight made a more complex and defensive style possible, and the French masters developed a school based on subtlety of movement, double-time parries, and complex attacks. When buttoned with a leather safety tip that resembled a flower, the smallsword was known as le fleuret, and was identical in use to the modern foil (still known as le fleuret in French). Indeed, the French smallsword school forms the basis of most of modern fencing theory.
By the mid-19th century, duelling was in decline as a means of settling disputes, partly because victory could lead to a jail term for assault or manslaughter. Emphasis shifted to defeating the opponent without necessarily killing him, and less fatal duelling forms evolved using the duelling sword, or épée de terrain, a blunt-edged variant of the smallsword. Later duels often ended with crippling thrusts to the arm or leg, and fewer legal difficulties for the participants. This is the basis of modern épée fencing.
Cutting swords had been used in blood sports such as backsword prizefights at least as far back as the 17th century. Broadswords, sabres, and cutlasses were used extensively in military circles, especially by cavalry and naval personnel, and saw some duelling application in these circles as well. Training was performed with wooden weapons, and stick fighting remained popular until Italian masters formalized sabre fencing into a non-fatal sporting/training form with metal weapons in the late 19th century. Early sport sabres were significantly heavier than the modern sport sabre and necessitated a strong style with the use of moulinets and other bold movements. As with thrusting swords, the sabre evolved to lighter, less fatal duelling forms such as the Italian sciabola di terro and the German Schlager. Hungarian masters developed a new school of sabre fencing that emphasized finger control over arm strength, and they dominated sabre fencing for most of the 20th century.
Duelling faded away altogether in the early 20th century. A couple of noteworthy duels were fought over disputes that arose during Olympic Games in the 1920s. According to E.F. Morton (A-Z of Fencing) the last widely publicized formal duel occurred in France in 1954, ending with a scratch to the arm. German fraternity duelling (mensur) persisted longer, and may still occur with some frequency.