It was the first time such a step was taken by Israel since the wave of Palestinian attacks that began in October, according to Israeli media.
The move kept commuters from leaving or exiting the West Bank city and led to frustration as lengthy queues formed in some areas.
It also applied to foreigners, although United Nations officials, international NGOs and diplomatic staff were exempted, diplomatic and UN sources said.
It had said earlier in the day that only residents of Ramallah were being allowed in, while non-residents were permitted to leave. A military source said greater emphasis was placed on checking those exiting.
Also Read
It was not clear when the last time such a move had been taken by Israel, though heavy restrictions were put in place during the second Palestinian intifada, or uprising, between 2000 and 2005.
AFP journalists reported that enforcement of the measures varied significantly. Checkpoints near Jerusalem remained open and appeared to operate normally.
It was part of four months of Palestinian knife, gun and car-ramming attacks targeting Israelis. Most of the attacks have been stabbings, though shootings have also occurred.
The shooting near Ramallah, where the Palestinian Authority is based, marked at least the second time a Palestinian security officer has been implicated in an attack in the current wave of violence.
On Sunday, Israeli Prime Minister Benjamin Netanyahu lashed out at Palestinian president Mahmud Abbas on his Facebook page, saying he "has not condemned this attack that was carried out by one of his men".
Several other roads connecting Ramallah with the northern West Bank were also closed or restricted. At one checkpoint, soldiers were checking cars leaving but not those entering.
A large number of Palestinians, aid workers and diplomats commute to Ramallah on a daily basis.
"The travel restriction on Palestinians is having an effect in terms of our ability to engage," one Western diplomat said.