WASHINGTON — Defense Secretary Jim Mattis on Thursday accused Iran of funneling money into Iraq to sway the outcome of its elections in May, calling it part of a broader pattern of destabilizing Iranian actions across the Middle East.

Mr. Mattis declined to say what outcome Iran was aiming for in Iraq, but he said it was sending “not an insignificant amount of money” to the country to sway votes. He mentioned no dollar amounts.

Iran is widely seen as gaining more influence in Iraq during its period of instability after much of northern and western Iraq was taken over by Islamic State militants in 2014. The militants have since been largely defeated, but Iraq’s political stability still hangs in the balance.

“We have worrisome evidence that Iran is trying to influence — using money — the Iraqi elections,” Mr. Mattis told reporters flying with him to Washington from the Persian Gulf island state of Bahrain, where he discussed Iran and other issues with senior government officials.