Israeli police and medical services say an attacker has opened fire at the entrance to a town outside Jerusalem, killing three Israelis.

Police spokesman Micky Rosenfeld says the attack took place early on Tuesday just outside the community of Had Adar.

There was no word yet on the identity of the attacker but Rosenfeld says it's being treated as a terrorist attack. The Magen David Adom medical service says a fourth Israeli is in critical condition.

Since 2015, Palestinians have killed 48 Israelis, two visiting Americans and a British tourist in stabbings, shooting and car-ramming attacks. In that time, Israeli forces killed over 255 Palestinians, most said by Israel to be attackers.