(Adds Palestinians saying man was unarmed, details from Israeli officials)
JERUSALEM, Jan 29 (Reuters) - Israeli soldiers killed a Palestinian on Wednesday who the military said had opened fire on their position near a Jewish settlement in the occupied West Bank.
The Palestinian Information Ministry said the man had been unarmed and had been holding a stick or rod he was using to direct traffic.
Confirming the man's death, a Palestinian medic identified him as Muhammad Mubarak, 21, a labourer from Jalazoun refugee camp near the Palestinian city of Ramallah, north of Jerusalem.
An Israeli military spokeswoman said a Palestinian gunman was shot after attacking troops stationed near the settlement of Ofra.
"The soldiers responded immediately to eliminate the imminent threat to their lives and fired at the terrorist, identifying a hit," she said.
An Israeli commander at the scene, identified only as Lieutenant "A", said on Army Radio the Palestinian man, who had been wearing an orange vest and doing construction work, had shot at him.
"We exchanged fire for a few minutes," the officer said, adding that the Palestinian was shot dead by a sniper from a nearby watchtower.
Lieutenant Colonel Peter Lerner, an Israeli military spokesman, wrote on Twitter the Palestinian had fired "some 17 rounds" at the soldiers, based on bullet casings found at the scene, and had shot at civilian vehicles.
Lerner tweeted a photograph of a gun that looked like a short rifle or sub-machinegun, said to have been found near the man's body.
Violence in the West Bank has increased in recent months, and at least 19 Palestinians and four Israelis have been killed in the occupied territory since U.S.-brokered peace talks resumed in July.
(Reporting by Maayan Lubell in Jerusalem and Noah Browning and Ali Sawafta in Ramallah; Writing by Jeffrey Heller; Editing by Andrew Roche)