The militant group Hamas praised the attack but did not assert responsibility. Hamas called the shooting a "new chapter" in Jerusalem's intifada, or uprising.
The 37-year-old Palestinian was well known in Har Adar — a wealthy community of luxury villas established in the 1980s — where he worked cleaning homes.
"Most of the people who lived here knew him," said Yitzhak Rabihya, a resident of Har Adar. "It's such a surprise here. We are a small community."
Around 100,000 Palestinians have permits to work in Israel and settlements in the West Bank; the majority of them are manual laborers. Permit holders are regularly screened by security services.
The incident came just three days before the Jewish holiday of Yom Kippur, when security forces were already on high alert. Israel has faced a spate of attacks over the past two years in what has been dubbed the "knife intifada," although it also has included shootings and car rammings.
The attack also coincided with a visit by U.S. Middle East envoy Jason Greenblatt, who is charged with reviving the long-stalled peace process. Israeli officials urged him to pressure Palestinian Authority President Mahmoud Abbas to condemn the attack and refrain from paying a stipend to the dead attacker's family, a practice that Israel says incentivizes violence.
At the entrance to Har Adar, the bodies of the victims could be seen being loaded into ambulances after the attack Tuesday morning, as Israeli special forces entered the Palestinian village and enforced a curfew.
Israeli Prime Minister Benjamin Netanyahu said that the home of the attacker would be demolished and that work permits for his extended family would be revoked.
"This murderous attack is the result of — inter alia — systematic incitement by the Palestinian Authority," he said.
The settlement, home to roughly 4,000 people, has a special arrangement that allows about 100 workers to enter each day without going through the main, clogged West Bank checkpoints, where Palestinians line up for hours.
"The fact that the terrorist exploited the entry of Palestinian workers into Israel to carry out an attack will have serious implications for the ability to employ Palestinians and ease their conditions of passage," said Israeli Intelligence Minister Israel Katz.
The attack is a message to Greenblatt that the security of Israel is paramount and "above any other consideration of easing the lives of the Palestinians," Katz said.
Palestinians say such attacks are caused by frustration stemming from 50 years of occupation.
Neighbors and Israeli news media reports identified the assailant as Nimr Mahmoud al-Jamal, a father of four.
Jamal does not fit the typical profile of Palestinian attackers, who more often are young, single men. Jamal's wife had recently left for Jordan, neighbors said, while Israeli police said there was a history of domestic abuse.
"O God," Jamal posted on his Facebook page before the incident. The page was later closed down.
"I'm not afraid," he had posted earlier, next to a picture of the bare back of a man flexing his muscles. "I testify that there is no God but God."
The Israeli army also shared a screenshot of a message that it said Jamal had sent to his wife — referred to as Umm Bahaa, or Mother of Bahaa — before the attack, asking her to post a note on his Facebook page. It was time-stamped at 6:51 a.m. "When you wake up and see this please share on my page," it said.
"I want to say that Umm Bahaa really was a good wife and tender mother and what you will see from me has nothing to do with my wife," said the message he requested to be posted.
Police identified the slain officer as Sgt. Solomon Gaviria, 20. He previously had been injured in a knife attack, Israeli news media reported.
One of the security guards killed was identified as Yossef Otman, an Arab Israeli from the town of Abu Ghosh. Israeli news reports identified the second security guard as Or Arish, a 25-year-old resident of Har Adar.
"Fact of the matter is that the security guards were both Arab and Jews," said Issa Jaber, head of Abu Ghosh's local council. "This shows that violence and killing has no father and mother. It can hurt every innocent human being."
Morris reported from Jerusalem. Sufian Taha in Jerusalem, Hazem Balousha in Gaza and Heba Habib in Stockholm contributed to this report.
Related: The 50 years war