In her pursuit of the Democratic nomination for president, Hillary Rodham Clinton has emphasized her ties to President Obama. She regularly tells the story of how he wooed her into serving as his secretary of state and recites, typically to a roar of applause, the line, “President Obama doesn’t get the credit he deserves.”

But the terrorist attacks in Paris on Friday, and a presidential election that has suddenly taken a turn toward foreign policy, have complicated Mrs. Clinton’s strategy of aligning herself closely with Mr. Obama, who is widely popular among Democratic primary voters and whose support she will need should she advance to the general election.

On Saturday, in the second Democratic debate, Mrs. Clinton declined to respond directly to a question about whether she thought Mr. Obama had underestimated the Islamic State, also known as ISIS or ISIL, which French officials have said was responsible for the attacks.

But she did, indirectly and deftly, contradict Mr. Obama’s comments, made in a television interview recorded a day before the attacks, that the Islamic State had been “contained” in Iraq and Syria.