text: Olivenza had been under Portuguese sovereignty since 1297 until it was occupied by the Spanish in 1801 , and formally ceded by Portugal later that year by the Treaty of Badajoz .
simplified: OlivenÃ a ( Spanish : Olivenza ) is a territory disputed by Portugal and Spain . The territory was under Portuguese rule between 1297 ( Treaty of AlcaÃ ices ) and 1801 .