CAMBRIDGE, Mass.  Nearly 40 years after Harvard expelled the Reserve Officers Training Corps program from its campus, university officials announced Thursday that they would officially recognize the Naval R.O.T.C.

Harvard was among several prominent colleges that banned the R.O.T.C. amid the movement against the Vietnam War. More recently, the program drew criticism on campuses because of the armed forces’ policy on gay men and lesbians in the military. Now, two months after President Obama signed a repeal of the “don’t ask, don’t tell” policy, some colleges are inviting R.O.T.C. back.

Harvard will formally recognize Naval R.O.T.C. in an agreement to be signed Friday by the university president, Drew Gilpin Faust, and the secretary of the Navy, Ray Mabus.

“Our renewed relationship affirms the vital role that the members of our Armed Forces play in serving the nation and securing our freedoms, while also affirming inclusion and opportunity as powerful American ideals,” Dr. Faust said in a statement.