Iranian President Hassan Rouhani has ordered a speed-up in the production of defense missiles. (Ebrahim Noroozi/AP)

Iranian President Hassan Rouhani on Thursday ordered a speed-up in the production of ­defense missiles as the United States is considering new sanctions over Iran’s ballistic-missile testing even while it prepared to lift old sanctions under the nuclear deal.

In a letter to the Defense Ministry made public by the official Islamic Republic News Agency, Rouhani said his order was a direct response to impending sanctions that the Obama administration has proposed to Congress.

“As the U.S. government is clearly still pursuing its hostile policies and illegal meddling . . . the armed forces need to quickly and significantly increase their missile capacity,” Rouhani wrote to Defense Minister Hossein Dehghan.

Rouhani tweeted that Iran will accept no restrictions on its missile testing and production. “If US continues its illegitimate interference w/ Iran’s right to defend itself a new program will be devised to enhance missile capabilities,” he wrote.

“We have never negotiated regarding our defense capabilities, including our missile program & will not accept any restrictions in this regard,” he said in another tweet.

The discord over new sanctions and missiles is coming at a time when Washington is preparing to lift old sanctions related to Iran’s nuclear program, as agreed under a landmark accord reached in July. Tehran recently shipped 25,000 pounds of enriched uranium and materials to Russia, and it appears to be on track to fulfill the rest of its commitments before the end of the month.

It is unclear whether the latest tensions will derail the nuclear deal’s implementation, but the dispute illustrates how decades of distrust are unlikely to lessen anytime soon.

Tehran and Washington have been sparring over missiles for months. The nuclear deal reached in Vienna in July dragged on as Secretary of State John F. Kerry and Iranian Foreign Minister Mohammad Javad Zarif argued over the lifespan of United Nations resolutions prohibiting the development of missiles. Although the issue was not specifically outlined in the nuclear agreement, a subsequent U.N. resolution includes an eight-year restriction on nuclear ballistic-missile activities and a five-year ban on conventional-arms transfers.

Since then, Iran has test-fired two ballistic missiles, in October and November.

Washington contends those actions violate the U.N. resolution, but Iran says that the missiles are not capable of carrying a nuclear warhead and aren’t covered under the ban.

Nevertheless, the tests prompted Washington to weigh new economic sanctions on about a dozen people and companies. The sanctions would require U.S. banks to freeze their assets and stop doing business with them.

“As we’ve said, we’ve been looking for some time at options for additional actions related to Iran’s ballistic missile program based on our continued concerns about its activities, including the Oct. 10 launch,” a senior administration official said by email.

Earlier Thursday, Iranian Foreign Ministry spokesman Hossein Jaberi Ansari said Iran would respond to fresh sanctions, which he called “meddlesome.”

“No measure can deny the Islamic Republic of Iran its legitimate and legal rights to boost its defense might and national security,” he said.

The missiles are not the only point of contention.

Congress last month imposed new visa restrictions, which Zarif said violate the nuclear agreement because they will keep potential investors and tourists from coming to Iran. Kerry has reassured Zarif that the White House could waive the restrictions, but Iran appears to be unconvinced.

Steven Mufson contributed to this report.