X is located in North Africa, and surrounded by countries like Egypt and Sudan. One one side, it is bounded by the Mediterranean Sea. Much of its territory is covered by the desert. X gained independence in 1951, and a monarch was elected to head it. The monarch was eventually overthrown.
Identify X.