His boss was fired, and in effect, so was he. Now Matthew S. Axelrod is moving on.

The former top deputy to the acting attorney general, Sally Q. Yates, who was dismissed by President Trump in January after refusing to enforce his executive order barring travelers from seven predominantly Muslim countries, Mr. Axelrod is joining a major global law firm, Linklaters.

He will be a partner in that 179-year-old British firm’s Washington office, in its white-collar defense practice.

He and Ms. Yates had planned to leave their jobs once Jeff Sessions was confirmed as attorney general. But a week after the Jan. 20 inauguration, the White House issued an order that closed the borders to those from Iran, Iraq, Libya, Somalia, Sudan, Syria and Yemen.

“It was always anticipated that we would stay only a short period,” Mr. Axelrod said in an interview. “For the first week, we managed, but the ban was a surprise. As soon as the travel ban was announced, there were people being detained, and the department was being asked to defend the ban.”