Pakistan's parliament has approved a constitutional amendment to officially merge its restive tribal areas into the mainstream political system, ending colonial-era laws and giving equal rights to its 5 million inhabitants.

The legislation passed on May 24 will attach Pakistan's Federally Administered Tribal Areas (FATA) to the northwestern Khyber Pakhtunkhwa Province, extend the jurisdiction of Pakistani courts to the region, and increase assistance to residents.

The legislation needs final approval from the Senate and the president’s signature -- seen as formalities after it received overwhelming support in the National Assembly.

Among the colonial-era laws that will be abolished are ones that called for the punishment of an entire tribe if one of its members were found guilty of a crime.

In the 19th century, British colonial rulers sliced out a mountainous region from Afghanistan to be run under a combination of civil laws and local traditions.

The special status continued after Pakistan gained its independence in 1947 to accommodate the wishes of tribesmen divided on either side of the border.

The territory has long been seen as a lawless backwater ruled by hostile tribesmen, left to serve as a buffer zone between Afghanistan and Pakistan.

The Pakistani Army largely regained control of the region in 2014-15, ending much, but not all, of the violence.

The United States has accused Pakistan of allowing the areas to serve as safe havens for militants fighting across the border in Afghanistan, allegations Islamabad has consistently denied.

Based on reporting by AP, AFP, dpa, The Nation, and RFE/RL's Radio Mashaal