|The Fulani herdsman travel vast distances tending their cattle|
The ban, in the south-eastern Benue state, follows years violent and often deadly clashes between nomadic Fulani herdsman and local farmers.
The herders accuse farmers of killing their cattle while the farmers say the animals are destroying their crops.
The new law would require everyone to keep their livestock on ranches.
- Africa Live: More on this and other stories
- Making sense of Nigeria's Fulani-farmer conflict
- Nigeria's deadly battle for land
Those breaking the law face the possibility of a five year jail sentence.
The Fulani herdsman say it unfairly targets their nomadic way of life, but the Benue state government says its aim is to restore peace, reports the BBC's Chris Ewokor from the capital, Abuja.
Destruction of communities
The herders have been forced from their more traditional grazing lands in the north by the Boko Haram insurgency, and the encroaching desert.
It has put them in direct conflict with local farmers, resulting in death and the destruction of entire communities.
The Global Terrorism Index says Fulani militants were responsible for almost 1,800 deaths during 2014 and 2015, leading to the government ordering a crackdown on the herders.
It considers the herders' raids as the second-biggest threat to peace in the country after the Islamist Boko Haram militants.
However, the Fulani insist they are only trying to defend themselves and preserve their way of life.
Who are the Fulanis?
Image copyright Getty Images
Image caption Nigeria has suffered for years with communal violence, often linked to cattle raiding
- They are believed to be the largest semi-nomadic group in the world and are found across West and Central Africa - from Senegal to the Central African Republic
- In Nigeria, some continue to live as semi-nomadic herders, while other have moved to cities
- Unlike the more integrated city dwellers, the nomadic groups spend most of their lives in the bush and are the ones largely involved in these clashes
- They herd their animals across vast areas, frequently clashing with farming communities
- They are often linked with another group, the Hausas, having lived together for a very long time. Some refer to the Hausa-Fulanis but they are different groups
- The Fulanis played a key role in 19th Century revival of Islam in Nigeria