ISLAMABAD, Pakistan — A Pakistani court on Thursday disqualified the country’s foreign minister from Parliament for concealing foreign assets, a setback to the governing party just months before the country heads to general elections.

The official, Khawaja Muhammad Asif, who also received a lifetime ban from holding public office, is a close ally and confidant of the ousted Prime Minister Nawaz Sharif, of the Pakistan Muslim League-Nawaz party. Its main rival is the Pakistan Tehreek-e-Insaf party, which is led by Imran Khan, a former cricketer.

The Muslim League has suffered a series of recent blows, including Mr. Sharif’s own dismissal from office last year and corruption inquiries into several of Mr. Sharif’s close aides. Mr. Sharif has accused the judiciary of bias, saying that while the courts have actively pursued cases against his loyalists, they have been lenient toward his political rivals.

The charges against Mr. Asif originated with a political rival from Mr. Asif’s home constituency in a district in eastern Pakistan. The rival, Usman Dar, filed a petition alleging that Mr. Asif possessed a work permit for the United Arab Emirates and had not disclosed it in election nomination papers. Under Pakistani law, a candidate has to disclose all foreign and local assets to be able to run for Parliament.