WASHINGTON – Four years ago today, former Defense Secretary Robert Gates told the House Armed Services Committee, “In past testimony, I have cautioned that, no matter what you think about the origins of the war in Iraq, we must get the endgame there right. I believe we have now entered that endgame – and our decisions today and in the months ahead will be critical to regional stability and our national security interests for years to come.”

He was talking about details.

Gates’ prescience regarding Iraq is playing out even now, one day after car bombs and shootings killed more than 80 and wounded almost 300 people in mostly Shiite neighborhoods in Baghdad.

Since the last U.S. troops left Iraq in December, the Iraqi government has been deadlocked by sectarian bickering. The endgame Gates spoke of is clearly in jeopardy and U.S. national security and regional security are threatened by the growing tide of attacks.

But the underlying threat is the permissive environment that has allowed a resurgence by the Islamic State of Iraq, the al-Qaida linked terror organization that’s engineered a string of deadly terror attacks, including Sunday’s.

“As we proceed deeper into the endgame, I would urge our nation’s leaders to implement strategies that, while steadily reducing our presence in Iraq, are cautious and flexible and take into account the advice of our senior commanders and military leaders,” Gates said later in his testimony that day. “I would also urge our leaders to keep in mind that we should expect to be involved in Iraq for years to come, although in changing and increasingly limited ways.”

Again, he spoke of details.

Questions that loom today are beyond the 16,000 contractors, intelligence and diplomatic personnel currently in Iraq – many of whom are involved with the operation and protection of the largest embassy in the world (the U.S. Embassy) – how is the U.S. involved there, and is it the right kind of involvement?

As U.S. military forces inch toward an exit from Afghanistan, a mirror image of the Iraq endgame is emerging, beginning with the announcement of a public timeline which should have all combat troops out in 28 months. The Taliban seized upon that information and has reportedly tried to develop a strategy to undermine U.S. plans.

While the U.S. and NATO forces have had overwhelming success in the Afghan War, the Taliban has begun to chip away at the success by systematically ambushing International Security Assistance Force members.

Some Taliban have infiltrated the ranks of recruits and have been carrying out what’s called “green-on-blue” attacks – or “insider attacks” as current Secretary of Defense Leon Panetta calls them. Yes, some of the attacks have resulted from cultural misunderstandings, alleged disrespect of Afghan recruits and disputes.

But a significant number of attacks that have killed American troops were set up by the Taliban, accomplished by taking advantage of the fact that some details were overlooked when screening Afghan police recruits.

Again, details loom large.

Editor’s Note:In the last four years, WTOP National Security Correspondent J.J. Green has tracked the threats, policies and vulnerabilities dominating national security in the U.S. and beyond. Read the stories in his series – “The Situation: The State of U.S. National Security in 2012″ – here.