It has been, as Defense Secretary Robert Gates puts it, “the long goodbye.”

Since announcing he would be retiring at the end of this month, it’s been one “last” after another for the secretary. Last trip to Afghanistan! Last appearance before Senate Appropriations! On Thursday, Gates held his last news conference, and he used it to deliver a short but (we think) heartfelt tribute to the press.

Gates said that when he took office in December 2006 — succeeding Donald Rumsfeld — the relationship between the Pentagon and the media was “mostly characterized by mutual suspicion and resentment.” Indeed, Rumsfeld frequently butted heads with reporters, and his style could be caustic.

With the ascension of Gates, press interactions that had been considered combative gave way to something that, if not perfect, was a little softer.

“I made it a point when speaking to military officers, from cadets to generals,” he said, “to remind them that a vigorous, inquisitive and even skeptical press was a critically important guarantor of the -- of freedom under the Constitution and not to be treated as the enemy.”

Gates also happened to have a few early reminders about the importance of the press. He noted it was through the press that he first learned about how soldiers were being neglected at Walter Reed and how some in the Army and the Marine Corps had resisted the purchase of MRAPs, which had proved crucial to limiting casualties among troops in Iraq.

“Over the past four and a half years,” Gates said Thursday, “I have not always liked what I read, and like anyone else in government, I hate leaks -- maybe more than most.

“But,” he added, “I have great respect for your role as a watchdog on behalf of the American people and as a means for me to learn of problems that the building was not telling me about.”

Not a bad philosophy, we’d say.