The Barghawata (also Barghwata or Berghouata) was a confederation of Berber tribes of the Atlantic coast of Morocco, belonging to the Masmuda group of tribes. The Barghawata was formed after the conclusion of the Berber Revolt, in which the area was held by the various Berber locals. The nation was established as an independent state in the area of Tamesna on the Atlantic coast between Safi and Salé, under the leadership of Tarif al-Matghari, who served as its first king.