The Fall of Tlemcen occurred in 1518, when the Ottoman admiral Oruç Barbarossa captured the city of Tlemcen from its sultan, Abu Zayan, the last member of the Banu Zayan lineage.
The fall of Tlemcen followed the capture of Ténès, also by Oruç and his brother, Hayreddin. The Sultan of Tlemcen then fled to Fez in Morocco. Oruç crowned himself king of Tlemcen. The only survivor of Abu Zayan's dynasty was Sheikh Buhammud, who escaped to Oran and called for Spain's assistance.
This victory put Oruç in control of the backcountry behind the Spanish base of Oran, which greatly threatened their usual supply routes. This victory put Oruç in control of a considerable territory, the size of colonial French Algeria.I
The Spanish however soon reacted in 1518 by launching an attack on Tlemcen, which was 70 miles (110 km) away from Oran, and managed to corner and kill Oruç. They took possession of the region of Tlemcen.
Soon however, the king of Morocco raised a considerable army and marched on Tlemcen, expelling the Spanish.
The Ottomans would again exert direct influence in Tlemcen from 1545. That year, the Wattassid ruler of Morocco Sultan Ahmad was taken prisoner by his rivals, the sharifian Saadians. His successor, Ali Abu Hassun, regent for Ahmad's young son Nasir al-Qasiri, decided to pledge allegiance to the Ottomans in order to obtain their support.