WASHINGTON  President Obama and top Pentagon officials met repeatedly over the past year about repealing “don’t ask, don’t tell,” the law that bans openly gay members of the military.

But it was in Oval Office strategy sessions to review court cases challenging the ban  ones that could reach the Supreme Court  that Mr. Obama faced the fact that if he did not change the policy, his administration would be forced to defend publicly the constitutionality of a law he had long opposed.

As a participant recounted one of the sessions, Mr. Obama told Defense Secretary Robert M. Gates and Adm. Mike Mullen, the chairman of the joint chiefs of staff, that the law was “just wrong.” Mr. Obama told them, the participant said, that he had delayed acting on repeal because the military was stretched in two wars and he did not want another polarizing debate in 2009 to distract from his health care fight.

But in 2010, he told them, this would be a priority. He got no objections.

On Tuesday, in the first Congressional hearing on the issue in 17 years, Mr. Gates and Admiral Mullen will unveil the Pentagon’s initial plans for carrying out a repeal, which requires an act of Congress. Gay rights leaders say they expect Mr. Gates to announce in the interim that the Defense Department will not take action to discharge service members whose sexual orientation is revealed by third parties or jilted partners, one of the most onerous aspects of the law. Pentagon officials had no comment.