The first form of trebuchets were used in the early centuries BC in the Far East. They started being used in Europe about a millennium later. At this time, they still lacked many of the innovations that made them such an awesome weapon. The Franks improved upon the new "leverage artillery," and the upgrades made their way back east. The most advanced trebuchets so excelled in range in accuracy that they were still used a century after the introduction of gunpowder cannons.
Trebuchets were used almost exclusively in castle sieges. The time necessary for aiming meant that they could only fire at stationary targets. During a castle siege, trebuchets would be set up outside of the range of archers. From this safe location, they would hurl things at the defenders.
For maximum range, the trebuchet would launch projectiles high into the air. This made wide structures like towers and buildings easy to hit, but narrow walls difficult. Wooden buildings were particularly at risk because the trebuchet could fire incendiary payloads. Diseased animal carcasses, beehives, and even baskets of poisonous snakes and scorpions were launched over the castle walls to disrupt the defenses.
Many military forces choose to attack or intimidate fortresses with these massive projectile weapons, even when the designs were still unrefined. The Koreans used trebuchets in a 7th century war against the Japanese. The Scandinavians used the siege engines so often that they were once thought to have invented them. For example, the Vikings used a trebuchet in the 885 siege of Paris. A trebuchet was used by Cortes at the siege of Tenochtitlan in 1521. However, the Spanish forces failed to aim the unit correctly, and it launched a boulder straight up. When the rock fell back to earth, it demolished the trebuchet.
Trebuchets were used predominantly to attack castles, but they could also hit units that had to remain stationary namely, other trebuchets. Many castles employed trebuchets within their walls that they could fire against attacking siege engines. Because of its high trajectory, the trebuchet could launch from behind the castle walls and out of sight of the attacking forces.