The forecastle ( FOHK-s?l; abbreviated fo'c'sle or fo'c's'le) is the upper deck of a sailing ship forward of the foremast, or the forward part of a ship with the sailors' living quarters. Related to the latter meaning is the phrase "before the mast" which denotes anything related to ordinary sailors, as opposed to a ship's officers.
In medieval shipbuilding, a ship of war was usually equipped with a tall, multi-deck castle-like structure in the bow of the ship. It served as a platform for archers to shoot down on enemy ships, or as a defensive stronghold if the ship were boarded. A similar but usually much larger structure, called the aftcastle, was at the aft end of the ship, often stretching all the way from the main mast to the stern.
Having such tall upper works on the ship was detrimental to sailing performance. As cannons were introduced and gunfire replaced boarding as the primary means of naval combat during the 16th century, the medieval forecastle was no longer needed, and later ships such as the galleon had only a low, one-deck high forecastle. Sailors stationed on the forecastle, or "forecastle men", were responsible for handling the headsails and the anchors. In the Royal Navy of the 17th and 18th centuries, these roles were reserved for older seamen who lacked the agility to go aloft or take other more strenuous duties aboard.
By the end of the 19th century, a raised forecastle had become a typical feature on warships again, in an attempt to keep forward gun positions from getting unacceptably wet on heavy seas. In addition the forecastle may provide additional crew's quarters as in the past, and may contain essential machinery such as the anchor windlass. A disadvantage of such a design is the structural weakness at the forecastle 'break' (the rear end of the forecastle with the main deck behind and below) relative to a flush deck structure.
Some sailing ships and many modern non-sail ships have no forecastle as such at all but the name is still used to indicate the foremost part of the upper deck - although often called the foredeck - and for any crew's quarters in the bow of the ship, even if below the main deck.