The Reale Udienza was the supreme court of the Kingdom of Sardinia. It was founded by a royal decree of Philip II of Spain, also king of Sardinia, on 18 March 1564, and lasted until 2 November 1847, when it was converted into an appellate court and renamed the Senate of Sardinia. It sat in Cagliari, the island's capital. The president of the court was the Viceroy, joined by the chancellor, the finance minister and three professional judges. Philip II's decree was provoked by the Sardinian parliament, the Stamenti, which requested a local court for the more prompt administration of justice, since at the time Sardinians had to go to the Supreme Council of Aragon to make an appeal. A second decree of 3 March 1573 gave concrete organisation to the nascent institution. Designed on the audiencias of Aragon and Catalonia, initially it heard civil and criminal cases brought by those exempt from ecclesial and baronial courts. Gradually it usurped authority over these, and even came to exercise viceregal authority when the post was vacant and to grant exequatur for ecclesiastical acts. In 1651 a second court, the Regio Consiglio, was established to deal with crimes against public order, such as counterfeiting, forgery, carrying illegal weapons, public decency, gambling and illegal marriage. The Consiglio also took over from lower courts cases that had gone on over five months that required immediate resolution. It also handled cases of alleged embezzlement, bribery or unlawful detention in the lower courts, and those of widows, students and the poor who submitted complaints within a certain period. In 1795, the Consiglio di Stato was formed in order to process supplications to the viceroy and the Reale Udienza. Finally, in 1818, a royal edict confirmed the two chambers, the Udienza and the Consiglio, as covering respectively civil and criminal cases. On the eve of the "perfect fusion" between Sardinia and Piedmont, King Charles Albert revoked the Udienza's political authority and changed its name to Senato di Sardegna. The next year the Senate, reduced to the function of an appellate court, adopted the procedures and the civil code of Piedmont. On 3 October 1848, it was transformed into the Magistrate of Appeals divided into three classes, two sitting at Cagliari and one at Sassari. The edict came into effect on 1 January 1849 and with it was abolished the Magistrato della Reale Governazione, which had sat at Sassari. On 1 April 1854 the Magistrate of Appeals became the final appellate court on the island.