Natan Blanc, a 20-year-old Israeli who has been in jail for months for refusing to enlist in the IDF over his objections to Israel’s policies in the West Bank, was exempted on Thursday morning by the army due to “incompatibility” with military service, and will be freed next week.

Upon his release, Blanc will have served a total of 178 days in jail in several consecutive stints. His refusal to serve had put the military in a delicate position: Releasing him could set an unwanted precedent, but keeping him jailed threatened to turn his private protest into a public relations debacle.

“The main reason that I am refusing to serve is that I feel that our country is going toward a non-democratic situation of civil inequality between us and the Palestinians, a situation in which there are two peoples in the same state, one of which has the right to vote and participate in elections, and the other does not,” Blanc said several months ago. “I believe the Israeli military plays a major role in preserving this situation, and my conscience does not allow me to participate in it.”

Blanc had requested permission to serve in the civilian paramedic service, but was refused by the army. Blanc also refused an army suggestion that he be declared unfit for IDF duty due to “psychological issues.”

Moshe Yinon, a former military judge, said this week that the army can often find ways to accommodate young Israelis who oppose serving, but it draws the line at political objections. He said the army differentiates between “pacifists,” who oppose any use of violence, and “selective objectors” who oppose certain Israeli policies. Blanc would fall into the second category.

“There is no place for political ideas in the army. It’s a matter of principle,” he said. During Israel’s withdrawal from the Gaza Strip in 2005, for example, soldiers were jailed for refusing to participate in the evacuation of Jewish settlers, he said.

The army would not provide statistics on the number of conscientious objectors, but outside experts said they are relatively rare.

Ishai Menuchin, an activist in the Israeli group Yesh Gvul, which assists soldiers who object to the occupation, estimated that dozens of Israeli youths refuse to serve each year.

Earning an exemption as a “pacifist” requires approval from a special committee and is almost never granted, he said. In most cases, the military dismisses objectors as “unfit” for physical or psychological reasons. A small number are sent to jail for short stints, and then agree to meet with a mental health officer to receive an exemption on psychological grounds.

“The army prefers this. You accept that there is something wrong about you,” he said.

But Blanc refused to take that escape route.

“He’s not going to lie to get out. That’s apparently what’s required,” said Blanc’s father David, himself an IDF officer. “We know he is stubborn. But we didn’t realize it would go on this long. His principles are what they are. He should certainly follow his conscience…I think I’m proud for standing up for what he believes in.”

Last week more than 30 Israeli legal experts, including the dean of Hebrew University’s law school, signed an open letter urging the army to release Blanc and saying the detention violated his freedom of conscience. On Tuesday, several dozen of his supporters demonstrated outside Israel’s military headquarters.

Blanc’s predicament aroused a passionate debate in the Jewish blogosphere, including supporting and dissenting opinions publishing in The Times of Israel.

It is unclear if his release, which comes at a time of national debate over universal conscription for Israel’s ultra-Orthodox and Arab citizens, will set a legal precedent for future ideological objectors to receive a pass from IDF service.

The Associated Press contributed to this report.