The Imperial Harem or Harem was one of the most important powers of the Ottoman court. Beginning in the 16th century and extending into the 17th, the Harem effectively controlled the Ottoman Empire (see Sultanate of the women). The harem had its own internal organization, and order of formulating policies.
For the perpetuation of the dynasty and service to the Ottoman Dynasty, beautiful and intelligent girls were brought in from the neighbouring countries to become imperial concubines (Cariyes). The concubines who were introduced into the Harem in their tender age were brought up in the disciplines of the Palace. They were promoted according to their capacities and became kalfas and ustas. The concubine, with whom the Sultan shared his bed, became a member of the dynasty and rose in rank to attain the status of Gözde (the Favourite) or Kadınefendi (one of the Sultan’s consorts). The highest position herself was the Queen Mother (Valide Sultan), the mother of the Sultan, who herself used to be a concubine of the Sultan’s father and rose to the supreme rank in the Harem. No concubine could leave or enter the premises of the Harem without the explicit permission of the Queen Mother. The powers of the Queen Mother even extended to questions of life and death of a concubine, with eunuchs directly reporting to her. The concubines either lived in the halls beneath the apartments of the consorts, Queen Mother and the Sultan, or in separate chambers. The consorts, kadınefendi, who had borne children to the sultan and whose number varied between four to eight formed the group who came next in rank to the Queen Mother. Among those women who lived in their own quarters with their concubines and children (‘’Baş Haseki’’), the favourite consort who was the mother of the crown prince and three other kadınefendis enjoyed a privileged position in the hierarchy of the harem.
At Topkapı Palace, at the court of the Ottoman sultans, the harem staff commonly included eunuchs. These were slaves, either captured in war (mainly Christian Europeans in the Balkans) or recruited within the empire (especially Caucasian peoples from Georgia and Armenia and blacks from Egypt and Sudan) or even beyond (especially in Abyssinia). Black eunuchs usually were Sandali (i.e. their genitalia were entirely amputated), hence they were preferred for harem service, while White eunuchs usually kept part of their penis and/or testicles, so they were assigned to less 'intimate' duties, e.g. secretarial. They were often donated to the Sultan by his governors, in total about six- to eight hundred.
The castrated servicemen in the Muslim and Turkish states in the Middle Ages were recruited to serve in the palace from the times of Sultan Mehmed I onwards. These eunuchs who were trained in the palace and were given the charge of guarding the harem rose in rank after serving in many positions. The harem eunuchs and the harem organisation were under the command of the Chief harem eunuch, who was also called the Master of the Girls (Kızlar Ağasi) or Chief (Black) Eunuch. They supervised the quarters where the female population of the palace lived. They had influence on the palace and later on the state administration in the 17th and 18th centuries as they had access to the sultan and the sultan's family and became very powerful. Eunuchs at the Ottoman court were preferably taken from Africa, especially Sudan. Since lighter skin was considered more aesthetic than dark skin, the sultans felt the chances of an affair developing between their, mostly Eastern European, concubines and their dark-skinned eunuch caretakers extremely low.
He was sometimes considered second only to the Grand Vizier (head of the imperial government, but often working in his own palace or even away, e.g., on military campaign) in the confidence of the Sultan, to whom he had and arranged access (including his bedchamber, the ne plus ultra for every harem lady), also being his confidential messenger. As commander of an imperial army corps, the halberdiers (baltaci), he even held the supreme military dignity of three-tail pasha (general).
Meanwhile the Chief (White) Eunuch (Kapı Ağasi), was in charge of 300 to 900 white eunuchs as head of the 'Inner Service' (the palace bureaucracy, controlling all messages, petitions, and State documents addressed to the Sultan), head of the Palace School (school for pages training as white eunuchs), gatekeeper-in-chief, head of the infirmary, and master of ceremonies of the Seraglio, and was originally the only one allowed to speak to the Sultan in private. In 1591, Murad III transferred the powers of the white to the black eunuchs as there was too much embezzlement and various other nefarious crimes attributed to the white eunuchs, but later they regained some favor.
During the Women's Sultanate (Kadınlar Sultanati), the eunuchs increased their political leverage by taking advantage of minor or mentally incompetent Sultans, causing political instability. The teenage Sultans were "guided" by regencies formed by the Queen Mother (Valide Sultan), the Grand Vizier and the Valide's other supporters- and the Chief Black Eunuch was the Queen Mother's and Chief Consorts' intimate and valued accomplice.
The Ottoman harem was often called "the golden cage". Male princely heirs lived in a part of the palace that was called kafes, which translates as "cage" from Ottoman Turkish. Here the princes had to live in seclusion until they were either executed so as not be a threat to the crown prince, or be released once they become sultans.