PITTSFIELD, Mass. — A Massachusetts museum that was previously blocked from selling 40 pieces of art to stay afloat is now poised to sell its most valuable Norman Rockwell painting.

The Berkshire Museum says the state’s attorney general has agreed to let it sell “Shuffleton’s Barbershop” as long as it goes to a nonprofit museum and is first displayed at the Norman Rockwell Museum in Massachusetts for at least 18 months.

A proposal submitted to the state’s highest court Friday says an undisclosed museum has offered to buy the 1950 painting. The deal will need the court’s approval to go through.

After the sale of the Rockwell painting, the museum would be allowed to sell other paintings in three batches until profits reach $55 million, the amount needed to keep the museum running.