What helped ranchers to secure their cattle but ended the Cattle Kingdom in Texas?

(one sentence with 21 explanation)

The invention of barbed wire helped ranchers secure their cattle, but it also led to the fencing off of large grazing lands, reducing the open range and eventually bringing an end to the Cattle Kingdom in Texas.