A police statement identified those slain in Tuesday's attack, noting that "a foreigner from Ukraine, aged 23" and "a foreigner from Ukraine, aged 32" were among them.
According to police, Diaa Armashah, a Palestinian from the West Bank village Yabad, had opened fire in the centre of Bnei Brak, killing the Ukrainians as they sat outside a shop, before proceeding to kill two other Israelis nearby.
A police officer who arrived at the scene was also shot dead, before Armashah was killed, police said.
Israel is home to around 15,000 Ukrainian nationals, but since Russia invaded Ukraine on February 24, the Jewish state has received nearly 20,000 refugees from Ukraine, an interior ministry spokeswoman said.
Reports indicated the two men killed in Tuesday's attack had been in Israel for a while and were not refugees from the war in Ukraine.
Tuesday's attack was the third fatal gun or knife attack in Israel in the past week.