"They were released yesterday afternoon," three days after the Palestinian security forces took them into custody, the official told AFP on condition of anonymity.
The men were among about 30 Palestinians who visited the West Bank settlement of Efrat on Wednesday during the annual Jewish festival of Sukkot, said Oded Revivi of the Yesha council for settlements.
Palestinians are forbidden from "normalising" relations with Israeli settlements in the West Bank, which the Jewish state seized in 1967 in a move the international community has never recognised.
The four Palestinians had been called in for questioning on Thursday, the official added, without saying if they had been charged with any crime.
More From This Section
Israeli Prime Minister Benjamin Netanyahu said on Facebook that the four men "did no harm to anyone" by visiting the settlement.
"I call on the international community to work to help free these innocent Palestinians whose imprisonment is yet another proof of the Palestinian refusal to make peace," he said yesterday.
More than 400,000 Israelis live in settlements in the West Bank, considered by the international community one of the largest obstacles to peace.
The US government has recently intensified its criticism of Israel's ongoing settlement expansion, saying it was endangering the possibility of a two-state solution to the conflict.