ROME — Luigi Di Maio, the political leader of the anti-establishment Five Star Movement, looked giddy as he led the rest of Italy’s new populist government into a frescoed room in Rome’s Quirinal Palace on Friday to be sworn in by a president whose impeachment Mr. Di Maio had demanded only days earlier.

“I swear to be faithful to the republic,” Mr. Di Maio said under the crystal chandeliers and vaulted ceilings before shaking the hand of President Sergio Mattarella. And, he added, he pledged “to loyally serve the Constitution and the laws and to carry out my functions in the exclusive interests of the nation.”

After a long electoral campaign in which Five Star and their governing partners, the anti-immigrant League, riled up anger and electoral support with vitriolic attacks on the European Union, illegal migrants and their rivals in the Democratic Party, the question turned to how they would actually govern.

Despite the doubts demonstrated by Italy’s president and the global markets over their anti-euro tendencies and worries among European Union leaders about an erosion of liberal values and the bloc itself, the leaders of the alliance seemed intent on renegotiating Italy’s relationship with Brussels and cracking down on migration. Their early statements in power do not indicate a sudden change of heart.