The federal government has lost a bid to thwart a court challenge aimed at compelling Prime Minister Stephen Harper to fill Senate vacancies.

Federal Court Justice Sean Harrington rejected Thursday the government's motion to have the case dismissed.

The case was launched by Vancouver lawyer Aniz Alani, who maintains the unfilled vacancies are unconstitutional, leaving provinces under-represented and the Senate less able to carry out its constitutional role as the chamber of sober second thought.

He is asking the court to declare that Senate vacancies must be filled within a reasonable time.

From time to time the Senate, or some senators, may be a source of embarrassment to the government, to the House of Commons as a whole, and indeed, to many Canadians - Federal Court Justice Sean Harrington

Harper has not appointed a senator since March 2013 — when the scandal over improper expenses claimed by some senators began to engulf his government.

There are currently 20 vacancies in the 105-seat, unelected upper house.

Harrington has not yet heard arguments or ruled on the substance of Alani's challenge. But in rejecting the government's bid to have it tossed, he suggested there is an obligation to appoint senators, no matter how distasteful it might be in the midst of scandal.

"Without a doubt there is a political aspect to Senate appointments," Harrington said.

"From time to time the Senate, or some senators, may be a source of embarrassment to the government, to the House of Commons as a whole, and indeed, to many Canadians.

"However, I know of no law which provides that one may not do what one is otherwise obliged to do simply because it would be embarrassing."

Whose responsibility to appoint?

Harrington pointed out that the Supreme Court of Canada has "made it perfectly clear" that significantly changing the Senate or abolishing it would require a formal constitutional amendment and cannot be accomplished by stealth.

Federal lawyers had argued that it's the Governor General's constitutional responsibility to appoint senators and that it's only by convention that those appointments are made on advice from the prime minister.

They contended that conventions are not enforceable by courts and, in any event, that the Federal Court had no jurisdiction to hear such a case. Moreover, they maintained Alani's challenge was frivolous and had no chance of success.

Harrington begged to differ.

"I am not persuaded, on the record presently before me, that it is plain and obvious that Mr. Alani has no chance of success."