Cantref Gwarthaf was the largest of the seven cantrefi of Dyfed. It subsequently became part of Deheubarth in around 950. It consisted of the southeastern part of Dyfed containing most of the basin of the River Tâf.
The name means "upper-most zone". Its area was about 631 km2. Unlike the other Dyfed cantrefi which were divided into two (or fewer) commotes, Cantref Gwarthaf was divided into eight commotes: Amgoed, Derllys, Efelfre, Elfed, Penrhyn, Peuliniog, Talacharn, and Ystlwys. Its civil headquarters were at Carmarthen. Its ecclesiastical centre (and perhaps, in the Age of the Saints, the seat of a bishop) was probably also Carmarthen, although the churches at Llanddowror and Meidrim were also important.
The cantref was made part of the Norman March in the 12th century. Marcher Boroughs were established at Carmarthen, Llansteffan, Laugharne and St Clears, and many other castles were built. The commotes of Talacharn and Penrhyn became English-speaking at the time, but was subsequently re-cymricised (except for the coastal part of Talacharn). The rest of the cantref remained Welsh speaking, as it continues today.
At the time of the Acts of Union, the cantref was split between the newly formed counties, when Efelfre became part of Narberth hundred, Pembrokeshire and the rest became part of Carmarthenshire: Amgoed, Penrhyn, Peuliniog, Talacharn, Ystlwys and part of Derllys became Derllys hundred, while Elfed and the rest of Derllys were combined with Emlyn Uwch Cuch and Gwidigada commote of Cantref Mawr to form Elfed hundred.