The organizers of the New York City St. Patrick’s Day parade said on Wednesday that they were lifting a ban on openly gay groups marching under their own banner, bringing to a close more than two decades of bitter protests and controversy that thrust an annual celebration into the national gay rights debate.

The decision is a striking reflection of the evolution of gay rights in the city and in American society, and is a measure of changing attitudes in the hierarchy of the Roman Catholic Church.

Every year, the parade kicks off with a Mass at St. Patrick’s Cathedral, the most prominent Catholic church in the country, and the policy of banning gay groups from marching has long been seen by gay rights advocates as a reflection of the church’s hostility.

In recent months, Catholic officials have tried to emphasize the church’s acceptance of gays and lesbians as individuals, while defending the church’s opposition to same-sex marriage. That rhetorical shift has been embraced by Cardinal Timothy M. Dolan, who will serve as grand marshal for the parade next year.