WASHINGTON — Opening the window just a little further into his secret war on terrorists, President Obama publicly acknowledged for the first time on Friday that United States military forces had taken “direct action” against groups affiliated with Al Qaeda in Somalia and Yemen.

In a letter to Congress, Mr. Obama said American forces had engaged in “a limited number” of operations against members of the Shabab in Somalia and Al Qaeda in the Arabian Peninsula in Yemen, arguing that both posed a terrorist threat to “the United States and our interests.”

He gave no further details in the unclassified letter, which accompanied the latest update to lawmakers under the War Powers Act about military operations around the world. More details about the scope of the operations were included in the classified section of the report, administration officials said.

The disclosure formally confirmed what had long been known here and abroad, that the American war on Al Qaeda has spread far from the borders of Afghanistan and Pakistan, where it began more than a decade ago. In the past, officials acknowledged helping Somalia and Yemen battle extremists without confirming that American forces were sometimes involved in the fight.