WASHINGTON — The government says orders to U.S. factories shot up at the fastest pace in six months in June, reflecting big increases in petroleum prices and heavy demand for military equipment.

The Commerce Department reported Monday that orders rose by 1.7 percent in June, the best showing since a 1.9 percent rise in December.

The June increase is more than double the gain that economists had been expecting and was led by a 5.2 percent surge in orders for primary metals such as steel.

The report says orders for defense capital goods soared by 16.9 percent, the second consecutive double-digit gain. It reflects heavy demand for military hardware to fight the wars in Iraq and Afghanistan.