William Gerstenmaier, a NASA veteran, was removed Wednesday as head of the agency’s human exploration office, a sudden move that comes as the agency is seeking to restore a human-space-flight program and return astronauts to the moon.

Gerstenmaier, who served at the agency since 1977, had been in charge of some of NASA’s most high-profile programs and is known as a steady and methodical force at the agency’s headquarters. Known as “Gerst,” he was working alongside Boeing and SpaceX as they developed spacecraft capable of ferrying NASA’s astronauts to the International Space Station.

He was also leading the effort to return astronauts to the moon, which had become a priority for the Trump administration.

In an email to employees obtained by The Washington Post, NASA Administrator Jim Bridenstine said Gerstenmaier would become a special assistant to Jim Morhard, the deputy administrator.

The White House has shown frustration with the pace of getting U.S. astronauts to the moon, and with some of the problems that have plagued NASA’s marquee efforts, including the massive rocket it is building, known as the Space Launch System, which is years behind schedule and way over budget.

Vice President Pence this year directed NASA to speed up dramatically its return to the moon — by four years, to 2024 — a move that took many in the agency by surprise.

In a speech in March, he took aim at NASA’s bureaucracy, saying the agency “must transform itself into a leaner, more accountable and more agile organization. If NASA’s not currently capable of landing American astronauts on the moon in five years, we need to change the organization, not the mission.”

He said the United States needed a renewed sense of urgency to compete with powers such as China. “It’s not just competition against our adversaries,” he said. “We’re also racing against our worst enemy: complacency.”

In the email to NASA employees sent Wednesday evening, Bridenstine wrote: “As you know, NASA has been given a bold challenge to put the first woman and the next man on the Moon by 2024, with a focus on the ultimate goal of sending humans to Mars. In an effort to meet this challenge, I have decided to make leadership changes to the Human Exploration and Operations (HEO) Mission Directorate.”

He said that Ken Bowersox, a former astronaut, who had served as the deputy associate administrator for the human exploration office, would take over in an acting capacity.

Bill Hill, who had served with Gerstenmaier as deputy associate administrator in the human exploration office, was also reassigned. He will be a special adviser to Steve Jurczyk, NASA’s associate administrator.