Why did farmers start building barbed wire fences on their farms in the Great Plains?

Cattlemen let their cattle roam onto the farms, trampling crops.
Foxes entered their properties hunting chickens.
Roaming peddlers sometimes camped on their fields.
Some farmers got into large disputes about the borders of their properties.