Kahramanmaras, not to be confused with Karaman, is a town located in the upper basin of the Pyramus (Ceyhan), the most important river of Cilicia, but from a historical point of view Maras (as the town was called until 1973) is not part of that region.

The castle

The Mongols invaded Anatolia in the XIIIth century and they weakened the control the Sultans of Rum had over that region. In Maras a local powerful family took advantage of the power vacuum to establish a beylik, a small principality. This beylik was named Dulgadir (or Dulgadirogullari) after the ruling family and it became a buffer state between the Mongol Ilkhanate of Persia and the Mamelukes of Egypt.
It also bordered on the Kingdom of Lesser Armenia, an ally of the Mongols, whereas the beylik was supported by the Mamelukes.

View from the castle (lower left corner Ulu Camii and Tas Medresesi)

In the late XIVth century the Ottomans expanded their possessions in Anatolia and in 1399 Sultan Yildirim (Thunderbolt) Beyazit I conquered Maras. The Dulgadir took advantage of another invasion to regain control of their beylik: in 1402 Sultan Beyazit was defeated and captured at Ankara, by Timur, a warlord who was based in Samarkand in Central Asia. Timur favoured the return to power of the Dulgadir.
Sultan Mehmet I, son of Beyazit, re-united the traditional Ottoman possessions in 1413 and he established an alliance with Dulgadir by marrying Emine Hatun, daughter of the Maras bey. She was the mother of Sultan Murat II.

The Dulgadir beylik was an Ottoman ally for almost a century until the expansionist policy of Sultan Selim I led the bey of Dulgadir to form an alliance with Mamelukes and Safavids (Persians) to contain the Ottoman threat; Sultan Selim intervened before his enemies could join forces and occupied Maras; the small beylik was annexed and the members of the local dynasty were either executed or joined the Ottoman ruling class.

Old houses in Kurtulus (Liberation) district

After the annexation to the Ottoman Empire Maras became a sleepy provincial town: this situation lasted until February 1919 when British troops occupied Maras, as a consequence of the collapse of the Ottoman Empire at the end of WWI. In November 1919, the British were replaced by French troops who were complemented by many Armenians; this led to the almost immediate reaction of the Muslim population of Maras; for three months the French had to face urban warfare, which eventually forced them to leave the town followed by the Armenian community.
In the course of these events many historical monuments were damaged, chiefly the castle, of which only a few walls survived.
In 1973 the Turkish Parliament added Kahraman (heroic) to the name of the town, hence Kahramanmaras (a similar recognition was given to Antep and Urfa).

Kurtulus district: (left) a decorated entrance; (right) the door of a Muslim house

The recent urban development of the town has added to the destruction of old Maras, with only the bazaars and the district behind them retaining some old buildings. This district is now called Kurtulus (Liberation), but in the past it was the Jewish quarter and this may explain why it was less damaged during the 1919 urban warfare; towards the end of the XIXth century not many Jews still lived in Maras and some of their houses
were bought by Muslims; in some instances the new landlords made clear their ethnic/religious allegiance by decorating their doors with nails composing a crescent moon and a star, a symbol of Islam and of the Ottoman Empire (and of today's Republic of Turkey).