KABUL, Afghanistan (CNN) -- The Afghan government will change a law that critics say legalizes rape within marriage for Shia Muslims, President Hamid Karzai told CNN Thursday.

Critics had feared that Afghanistan's new Shiite law would set the nation backward.

Karzai told CNN's Fareed Zakaria that he and others were unaware of the provision in the legislation, which he said "has so many articles." Karzai signed the measure into law last month.

"Now I have instructed, in consultation with clergy of the country, that the law be revised and any article that is not in keeping with the Afghan constitution and Islamic Sharia must be removed from this law," Karzai said.

The president's comments came one day after several hundred demonstrators faced off over the law, which critics say prevents women from declining their husband's request for sexual intercourse and essentially legalizes marital rape.

The measure applies to the 20 percent of Afghans who are Shia Muslims. It was part of a nearly 270-page piece of legislation that was written to solidify the identity of the Shia minority in Afghanistan.

The bill languished in the country's parliament for a year-and-a-half before it was recently pushed through in what one legislator called a "chaotic" vote.

Women from various parts of Afghanistan marched in the capital Wednesday to protest the law, which has also been criticized by human-rights groups and Western leaders, including U.S. President Barack Obama. Watch Karzai react to controversial law ahead of Thursday's comments »

When the demonstrators reached a mosque housing a school run by a conservative Shia cleric who helped implement the law, students came out yelling and cursing and pelted the women with gravel, said Fawzia Koofi, a female member of the Afghan parliament.

Koofi said police did little to protect the women, but a spokesman for the country's interior minister disputed that.

"Police played a completely neutral role," said spokesman Zamarai Bashiri. "The police were able to control the demonstrations very well."

About 300 to 500 women protested the law while 600 to 700 demonstrators marched in support of it, he said. The marchers who opposed the law included several female members of Afghanistan's parliament.

"Both sides were able to express their thoughts and expressions," Bashiri said.

The law has drawn much criticism. Watch a report on the law »

"I think this law is abhorrent," Obama said recently. "We think that it is very important for us to be sensitive to local culture, but we also think that there are certain basic principles that all nations should uphold, and respect for women and respect for their freedom and integrity is an important principle."

French President Nicolas Sarkozy and German Chancellor Angela Merkel also weighed in.

"We very much hope that the draft piece of legislation is to be withdrawn," Merkel has said.

All About Hamid Karzai • Afghanistan • Barack Obama • Angela Merkel