The Justice Department is preparing to file criminal corruption charges against Sen. Robert Menendez (D-N.J.), law enforcement officials said Friday, setting the stage for a legal showdown between the Obama administration and the veteran lawmaker.

The anticipated charges, which the Justice Department could announce in a matter of weeks, would mark a final stage in a more than two-year investigation into the relationship between Menendez and Salomon Melgen, a close friend and political donor.

Federal officials are expected to allege that the senator used the power of his office to improperly benefit Melgen, an ophthalmologist and businessman who operates eye clinics in Florida.

Law enforcement officials confirmed the Justice Department’s plans, which were first reported Friday by CNN. The Justice Department and the White House declined to comment. So did an attorney for Melgen.

Menendez denied any wrongdoing Friday evening at a hastily arranged appearance in New Jersey during which he took no questions.

“I have always conducted myself appropriately and in accordance with the law,” the senator, shown here in February, said Friday evening. He later declared, “I am not going anywhere.” (Win Mcnamee/Getty Images)

“I have always conducted myself appropriately and in accordance with the law,” the senator said. He later declared, “I am not going anywhere.”

The charges would ensnare a leading political figure who has served in Congress for more than two decades and who recently has clashed with the administration over foreign policy issues.

At issue in the federal probe are questions about whether the senator skirted the law to use his influence in the Senate to advance Melgen’s business interests.

Twice in recent years — in 2009 and 2012 — Menendez and his top staff spoke directly to officials at the Centers for Medicare and Medicaid Services about the agency’s finding that Melgen had overbilled the government by $8.9 million for care at one of his clinics.

Menendez repeatedly questioned whether federal auditors had been fair in their assessment of Melgen’s billing for eye injections to treat macular degeneration. His office said he questioned the fairness and consistency of the federal agency in its decision-making with all doctors, not just Melgen.

The matter has been viewed as a particular challenge for prosecutors. While Menendez appeared to go to bat to help a donor’s bottom line — both with the State Department and with the Medicare agency — Melgen is also a longtime friend. Prosecuting an official for receiving gifts from a person who is a genuine personal friend can be difficult.

Another area in which Menendez appeared to use his position to help Melgen came after the doctor became the chief investor in a company holding a long-dormant port security contract in the Dominican Republic, the country where Melgen was born. The contract called for paying lucrative fees for security screening of ships coming into the port.

In the summer of 2012, as Melgen donated $700,000 to support Menendez and other Democrats, Menendez pressed for the United States to push the Dominican Republic to put the contract into effect. At a July Senate hearing he led on Latin American businesses, Menendez urged officials from the Commerce and State departments to apply pressure on countries that didn’t honor agreements with U.S. businesses. Without naming Melgen, Menendez highlighted the contract to provide security in the Dominican port.

Court filings, according to reports in the New Jersey Law Journal, indicate the government has argued that a Menendez staffer urged U.S. Customs and Border Protection not to provide screening equipment to the Dominican Republic so that Melgen could.

The law enforcement officials, who sought anonymity to discuss the pending case, said concerns from the FBI and federal prosecutors about the statute of limitations running out on some charges spurred the Justice Department to move ahead swiftly.

Democratic and Republican leaders on Capitol Hill were mostly quiet Friday on the subject of Menendez. In conservative circles, some called for him to step down, and American Commitment, a conservative organization, launched a petition drive calling for his resignation.

During the course of the federal investigation, grand juries convened in both Florida and New Jersey. But many white-collar ­legal defense experts had raised doubts about federal prosecutors’ ability to pursue charges against the senator, and some suspected the case had died.

Early in the investigation, Menendez faced and denied allegations that among the gifts Melgen provided him was access to prostitutes, some of them underage. Those allegations fizzled after the women who made them publicly recanted their stories.

On Friday, law enforcement officials said that the FBI was pushing prosecutors to charge Menendez and that the top prosecutor in New Jersey, where a grand jury has been hearing evidence, supported the case. The case is being run now by attorneys in the Public Integrity Section of the Justice Department.

Attorney General Eric H. Holder Jr. declined at a public event Friday to weigh in when asked by a reporter to comment.

In a statement, a Menendez spokeswoman insisted that the senator’s actions did not violate the law.

“Any actions taken by Senator Menendez or his office have been to appropriately address public policy issues and not for any other reason,” said Tricia Enright, his communications director.

The New Jersey Law Journal last week reported on court documents that were inadvertently made public and that indicated Menendez aides could be required to testify before a grand jury. The documents offered the most substantive window yet into the case against the senator.

Public corruption cases typically hinge on evidence of a quid pro quo, or proof of the improper exchange of political favors. Such cases, which are notoriously difficult to prove, involve claims that a public official has used or promised to use his or her government position in exchange for gifts or other things of value. A recent example is the prosecution of former Virginia governor Robert F. McDonnell (R), who was convicted of trying to help a businessman win state support for his product in exchange for more than $170,000 in loans and gifts. McDonnell is appealing the conviction.

On Capitol Hill, Menendez has maintained his prominence this year, even after surrendering his gavel as chairman of the Foreign Relations Committee when Republicans assumed control of the Senate.

The son of Cuban immigrants, he was a lonely but powerful voice among Democrats criticizing President Obama’s decision in December to normalize relations with Havana. He decried the trading of convicted Cuban spies for an imprisoned American aid worker, saying it “vindicated the brutal behavior of the Cuban government.”

In the new year, Menendez has assumed a leading role in the Senate debates over U.S. relations with Iran — again taking a harder line on the issue than the Obama administration.

At home in New Jersey, public opinion of Menendez has been more positive than negative. A Monmouth University poll released in February showed that 48 percent of residents approved of the job Menendez was doing, while 26 percent disapproved.

Menendez served in the House from 1993 to 2006, when he was appointed to fill a vacancy in the Senate. He was elected to a full term later that year and easily won reelection in 2012.

If Menendez were to leave office, his departure would shake up New Jersey politics. Most ambitious New Jersey Democrats have been focused on running to succeed Gov. Chris Christie (R) in 2017, and not on Menendez’s seat. Philip Murphy, a former Goldman Sachs official who served as Obama’s ambassador to Germany, has said he is considering a gubernatorial run, as has Jersey City Mayor Steven Fulop.

The state’s congressional delegation is dominated by Democrats, but most of them are older, including 78-year-old Rep. Bill Pascrell Jr. (D-N.J.) and 64-year-old Albio Sires (D-N.J.). Rep. Frank Pallone Jr. (D-N.J.) has expressed interest in higher office in the past but just won a grueling battle to serve as top Democrat on the House Energy and Commerce Committee.

Mike DeBonis, Scott Clement, David Nakamura, Ed O’Keefe and Adam Goldman contributed to this report.