It has been a long week for the last remaining Occupy encampment in New England.

Just as a showdown with City Hall seemed imminent Wednesday, residents of Occupy New Haven’s tents on the Green were granted a last-minute reprieve as a federal judge, Janet Hall, ruled that the encampment could keep its position on the upper Green for another two weeks. The ruling, which was announced Wednesday at 12:15 p.m. — 15 minutes after a noon deadline the city set Monday for the protesters to clear the space — forbade the city from removing the tents until midnight on March 28. A full hearing in the protesters’ suit to prevent the city from evicting them is scheduled for that same day before U.S. District Court Judge Mark Kravitz.

Hall agreed with an argument by Norm Pattis, an attorney representing the protesters, that removing the encampment would violate the protesters’ First Amendment rights, adding that, considering that the encampment has stood since Oct. 15, its presence for another two weeks would not excessively burden the city. Occupy New Haven will, however, be responsible for paying the city $1,000 for the portable toilets the city has provided protesters, Hall said.

Cooperation between City Hall and the Occupy protesters, which has been remarkably strong throughout the protesters’ five-month presence on the Green, began to deteriorate last month when city officials held two talks with protesters about the future of the anti-economic inequality demonstration. City officials argued that the Green is intended to be a space for all to enjoy and that the protest’s permanent presence was infringing on their ability to do so, while protesters said they should be allowed to continue to use the public space on which they were encamped.

Protesters rejected a city proposal last week that Occupy New Haven move to another part of the city by mid-March, holding a press conference Saturday and issuing its own demands to the city, including reduced pay for top city officials, longer library hours and an end to charter schools in the city. The city affirmed its intention to have the protesters move by announcing Monday that the Green would be cleared of structures on Wednesday, distributing fliers throughout the encampment announcing the coming removal. Protesters responded with a second press conference at which they announced their refusal to move.

Following Judge Hall’s ruling, Occupy protesters stormed City Hall, celebrating their victory with chants and asking to meet with Mayor John DeStefano Jr., who promised to discuss their demands with them within two weeks. Though protesters have argued that the city wants Occupy New Haven removed from the Green because of Yale’s Commencement, both DeStefano and University spokesman Thomas Conroy said the University has not played any role in the city’s decision to demand that protesters leave the Green.

In a separate incident Tuesday afternoon, New Haven Police Department officers were called to the Occupy New Haven encampment after an inebriated woman claimed to have been raped the night before. According to NHPD spokesman David Hartman, an investigation concluded that the woman had been raped sometime late Monday or early Tuesday, and officers arrested a suspect who has been charged with first-degree sexual assault.

CORRECTION: March 16, 2012

An earlier version of this article incorrectly stated the name of University spokesman Thomas Conroy.