Why did the Romans decide to switch entirely from spears to swords as primary weapons?

by Astalano

I know that the Romans decided to adopt a more Etruscan style of fighting due to the hilly Roman terrain, which caused their phalanx style of fighting to fail in war, but why did they decide to ditch the spear entirely?

The Etruscans seemed to able to fight in this kind of rapid assault warfare with less rigid formations, using spears and other weapons after launching javelins to disrupt formations.

Is it simply a matter of state standardisation? Is there any real evidence as to why the sword became favoured as the primary weapon of the Roman soldier?

Backlit_keys

To start off I'm assuming that you are speaking of the Early Republican Era during which the Romans transitioned from the Greek-styled phalanx to the "phalanx with joints" manipular system (this change was prompted by lessons learned during the Romans' conflict with the hill tribes of Samnium) which they utilized up until around the time of the Marian reforms in the late second century BC.

The Romans never permanently phased the spear out of use, and during the era of the manipular legion, the thrusting spear (hasta) featured prominently alongside Roman fighting swords of the time. In "The Histories" ancient writer Polybius describes both the principes and triarii of a Roman army as carrying hastae (long thrusting spears) in place of pila (short throwing spears). The triarii are noted as using the hasta as their primary weapon in battle.

Past the Marian Reforms and moving into the first century CE, Roman soldiers are still described as carrying spears along with swords, among other tools and implements. According to a translated version of the original source, historian Josephus, writing some time in the first century CE, describes Roman soldiers during the Jewish War as such:

"The footmen are armed with breastplates and headpieces, and have swords on each side; but the sword which is upon their left side is much longer than the other; for that on the right side is not longer than a span. Those footmen also that are chosen out from among the rest to be about the general himself, have a lance and a buckler; but the rest of the foot-soldiers have a spear and a long buckler, besides a saw and a basket, a pickax, and an axe, a thong of leather, and a hook, with provisions for three days; so that a footman hath no great need of a mule to carry his burdens."

This excerpt indicates continued use of thrusting spears by Roman units, and shows that even after the phasing out of the manipular system the Romans continued using spears in some capacity, despite having been known to favor swords, later adopting the gladius family of swords as their primary weapon on the line.

Now, as to why the Romans began to prefer the sword over the thrusting spear in fighting after the adoption of the maniple, I would like to point to a post made two years ago, which was thoroughly and handily answered by user u/kookingpot (https://www.reddit.com/r/AskHistorians/comments/2txsnw/why_did_the_bulk_of_roman_infantry_use_swords_as/?st=J26I1U0X&sh=6dbe6e08)

All in all, while the Romans never truly phased the spear out of use, they did transition to a style of fighting which more favored the sword. In the tight, enclosed spaces of a formation battle, the gladius and other short stabbing swords allowed a Roman soldier to attack (through stabbing or slashing) without needing to make distance between the enemy - an advantage a long thrusting spear or perhaps even a pilum used as such did not provide.

Sources:

Polybius, The Histories, Book 6.19-42

Josephus, On the War, Book 3 Chapter 5

And a bonus link if you're interested in reading about the manipular system in depth:

Polybius: Phalanx versus Maniple

p.s. My first reddit post :) I hope I answered and elaborated on your question thoroughly.