WASHINGTON — The Obama administration on Tuesday rolled back part of its ban on lobbyists serving in government, narrowing one of the president’s signature policies in the face of a legal challenge.

Under a new rule, registered lobbyists whom Mr. Obama had previously barred from serving on government advisory boards may now participate if they are representing companies or groups and not acting on their own behalf.

The change was published in the Federal Register and took effect immediately, the administration said. It comes after the United States Court of Appeals for the District of Columbia rejected the Obama administration’s efforts to dismiss a lawsuit by six lobbyists who challenged the ban’s constitutionality after being excluded from a trade advisory committee. The lobbyists said their First Amendment rights to petition the government had been violated.

Charles A. Rothfeld, the lawyer who handled the suit, said the change was gratifying. “The ban as it stood originally was irrational, because the point of these committees is to give private-sector entities the mechanism to present their views to the government,” he said, “and it made no sense to say you could pick anybody to represent you except for your lobbyist.”