In the 8th century AD, many roads were built throughout the Arab Empire. The most sophisticated roads were those in Baghdad, which were paved with tar. Tar was derived from petroleum, accessed from oil fields in the region, through the chemical process of destructive distillation. The Highways Act 1555 in Britain transferred responsibility for maintaining roads from government to local parishes. This resulted in a poor and variable state of roads. To remedy this, the first of the "Turnpike trusts" was established around 1706, to build good roads and collect tolls from passing vehicles. Eventually there were approximately 1,100 trusts in Britain and some 36,800 km (22,870 miles) of engineered roads.The Rebecca Riots in Carmarthenshire and Rhayader from 1839 to 1844 contributed to a Royal Commission that led to the demise of the system in 1844,[26] which coincided with the development of the UK railway system.