U.S. and Iranian officials reached a broad agreement on policy towards security in Iraq on Monday, in the first attempt at public diplomacy between the two countries in more than a quarter century.

The meeting, hosted by Iraqi Prime Minister Nouri al-Maliki, took place in Baghdad between U.S. Ambassador Ryan Crocker and his Iranian counterpart Hassan Kazemi Qomi.

The two ambassadors were greeted by al-Maliki and then shook hands before being led into a conference room. Al-Maliki then made a brief statement and exited the room, leaving his national security adviser to represent Iraq.

Crocker described the meeting as business-like and said Iran proposed setting up a "trilateral security mechanism" between the two countries and Iraq.

The American envoy also said Washington would need to study the proposal while calling on Iran to stop arming, funding and training Shiite militants.

"This is about actions, not just principles, and I laid out to the Iranians direct, specific concerns about their behavior in Iraq and their support for militias that are fighting Iraqi and coalition forces," he told a Green Zone news conference.

Iran wants the U.S. to leave Iraq, saying its presence is worsening sectarian violence between Shiite and Sunni Muslims.

Crocker said Iran is planning to propose another session.

"We will consider that when we receive it," Crocker said. "The purpose of this meeting was not to arrange other meetings."

He said the issue of seven Iranians currently in American custody was not raised.

"The focus of our discussions were Iraq and Iraq only," Crocker said.

The U.S. and Iran have not had formal diplomatic ties since the 1979 takeover of the U.S. embassy in Tehran.

Iran's Shiite theocracy fears that the U.S. administration is seeking regime change in Tehran.

On Sunday, Iran summoned the ambassador of Switzerland to complain about what it claims is a U.S. espionage network on its soil.

With files from The Associated Press