An ancient gilded coffin valued at about $4 million that was acquired by the Metropolitan Museum of Art was returned to Egypt in a repatriation ceremony Wednesday after prosecutors determined that it had been looted from the country.

The coffin was the centerpiece of the Met’s exhibit “Nedjemankh and His Gilded Coffin,” which opened in July 2018.

“Coming as we do from all over the world, New Yorkers place a strong value on cultural heritage, and our office takes pride in our work to vigorously protect it,” Manhattan DA Cyrus Vance said at the ceremony attended by Egyptian Minister of Foreign Affairs Sameh Hassan Shoukry.

“Returning stolen cultural treasures to their countries of origin is at the core of our mission to stop the trafficking of stolen antiquities. I am honored to repatriate this extraordinary artifact back to the people of Egypt,” he added.

The District Attorney’s Antiquities Trafficking Unit — headed by Assistant DA Matthew Bogdano – and officials from Homeland Security Investigations followed a paper trail that raised several red flags about the coffin’s provenance.

The forged May 1971 export license bore the stamp “AR Egypt,” referring to the Arab Republic — but at the time, the Arab Republic didn’t exist. The country was the United Arab Republic until September 1971, Vance explained.

In a joint probe with authorities in Egypt, Germany and France, officials executed a search warrant at the Met, which cooperated and handed over the ornate, mummy-shaped coffin, Vance said.

The coffin — which was crafted in Egypt in the first century BC — once contained the remains of Nedjemankh, a high-ranking priest of the Egyptian ram god Heryshef of Herakleopolis.

The coffin’s surface is decorated with scenes and texts in gesso relief that the museum has said were intended to guide Nedjemankh on his spiritual journey from death to eternal life, according to The Art Newspaper.

It was stolen from the Minya region of Egypt after the country’s 2011 revolution and smuggled to the United Arab Emirates.

It was later transported to Germany, where it was restored, and then to France, where it was sold by a Paris art dealer to the famed Fifth Avenue art museum in July 2017.

The museum has emphasized that all of the Met’s acquisitions undergo “a rigorous vetting process” that follows a 1970 UNESCO treaty, federal and state laws and the Association of Art Museum Directors’ guidelines, the news outlet reported.

“Today we are celebrating the return of one of our national treasures,” Shoukry said Wednesday. “It is not the protection of our heritage, but the protection of mankind’s heritage.”