delivered the opinion of the court.
On October 15, 1908, José Arrarás, as the assignee of Antonio Diez, commenced foreclosure proceedings in the Municipal Court of Añasco against Oarmen G-arcia, widow of Domingo Cruz, to recover a mortgage credit amounting to 650 provincial pesos for which a rural property situated in barrio Borrero in the municipal district of Rincón had been given as security, as evidenced by a public instrument of July 13, 1889, December 21 of the same year being tbe date set for the sale at auction of the above-mentioned property.
On November 19 of the previous year Emilia Bayron, widow of Raffucci, and the other plaintiffs loaned to Carmen G-arcia the sum of $2,500, secured by a mortgage on the same *514property hereinbefore mentioned, on condition that the mortgage credit, whose payment José Arrarás demanded, should he satisfied at once with part of this money. For the purpose of paying and canceling Arrarás’ mortgage and preventing the advertised auction sale the snm of $400, received from Alfredo Raffncci, was deposited by L. B. Martinez with the marshal of the aforesaid municipal court on December 18.
From the said $400 the marshal took $390, which is the .amount of Arrarás’ claim, and returned the remaining $10 to L. B. Martinez without deducting costs, and failed to advise him that he must pay them.
Notwithstanding the deposit made with the marshal, this officer, under the pretext that the costs had not been paid, proceeded to hold the auction sale set for December 21. The property was awarded to José B. Pérez for $550, and the corresponding deed of the judicial sale was executed in his favor and was recorded in the Registry of Property of Mayagfiez.
This was the state of affairs when Carmen G-arcia filed a complaint in the Municipal Court of Añasco against José Arrarás and Antonio Diez, asking that a judgment be rendered annulling the foreclosure proceedings hereinbefore mentioned on the ground that the amount claimed had already been paid by Carmen García. José Arrarás answered the complaint and filed a counterclaim for the sum of $751.20, which amount he alleged Carmen Garcia owed him for interest due and unpaid on the.mortgage he had foreclosed, .and $500 for attorney’s fees.
In this suit judgment was rendered dismissing the complaint for annulment and sustaining Arraras ’. counterclaim,. ■but upon the execution of said judgment Carmen García was found to have no property of her own, whereupon Alfredo Raffncci was ordered to appear in court and show whether the firm, Successors of Raffucci, of which he was the managing partner, owed certain amounts of money to Carmen Gar-*515cía. His answer Raying been in tbe negative, Arrarás asked for and obtained permission of tbe conrt to sne tbe said firm.
Tbe foregoing facts were alleged as grounds of a complaint filed in tbe District Court of Aguadilla on May 6, 1909, by Emilia Bayron, widow of Raffueci, and tbe other defendants, all of whom except one are residents of Rincón, against Carmen Barcia, widow of Cruz, José Arrarás, Antonio Diez, and José B. Pérez, wbo are all residents of Añasco except Carmen Barcia, wbo is a resident of Rincón. Tbe findings prayed for in said complaint are as follows:
First. Tbat tbe foreclosure proceedings prosecuted in tbe Municipal Court of Añasco by José Arrarás against Carmen Barcia are null and void, because tbe said court bas no jurisdiction to take cognizance of sucb proceedings.
Second. Tbat in view of tbe serious irregularities committed during said proceedings tbe sale at public auction to José B. Pérez, tbe deed executed in bis favor, and tbe record thereof in the registry are also null and void.
Third. Tbat tbe judgment sustaining tbe counterclaim entered by José Arrarás in tbe action brought to annul tbe foreclosure proceedings is likewise null and void, for tbe reason tbat sucb suit was tbe consequence of said void proceedings, and because tbe Municipal Court of Añasco bad no jurisdiction to try and determine tbe counterclaim in view of tbe amount thereof.
Fourth. Tbat tbe supplemental proceedings instituted in connection with tbe execution of tbe aforesaid judgment are likewise void, as well as tbe authority granted to Arrarás to sue tbe firm of Successors of Raffueci.
To this complaint José Arrarás entered tbe following demurrer :
First. Tbat tbe court bad no jurisdiction to try tbe case, since tbe action involved was one to annul proceedings in a municipal court over which tbe District Court of Mayagfiez bas jurisdiction.
*516Second. That the complaint does not state facts sufficient to constitute a cause of action.
Third. That plaintiffs have not the necessary legal capacity to institute the proceedings, since it does not appear that they were parties to the suit whose annulment is sought, or that they have any interest in the subject matter of the action.
Antonio Diez and José B. Pérez demurred to this complaint as follows:
First. That the court did not have jurisdiction to take cognizance of the causes in question, because the amount involved being under $500 jurisdiction thereof pertained to the Municipal Court of Añasco.
Second. That several actions have been misjoined.
Third. That there is a misjoinder of defendants.
Fourth. That the complaint did not state facts sufficient to constitute a cause of action.
The defendants, Diez and Pérez, also answered the complaint, admitting some of its counts and denying others, and prayed that it be dismissed.
After considering the demurrer the court, by an order of November 12, 1909, decided that in view of the subject matter involved in the action it had no jurisdiction to take cognizance of the complaint, because errors and irregularities committed by an inferior court in a proceeding and the nullity of that same proceeding and of the judgment rendered therein were dealt with, which nullity, errors, and irregularities could only be reviewed by resort to the proper ordinary and extraordinary remedies, such as an appeal and a writ of certiorari, from the district court of the district to which the inferior court belongs, which district court in the present case was that of Mayagüez, since the Municipal Court of Añasco is within its jurisdictional territory.
As a consequence of this order, the District Court of Aguadilla rendered judgment on March 18, 1910, dismissing the complaint with costs against the plaintiffs, for the rea-*517soil that that court had no jurisdiction to take cognizance of said complaint, and from this judgment the plaintiffs appealed to this Supreme Court.
The only question involved in the judgment appealed from is whether or not the District Court of Aguadilla had jurisdiction to take cognizance of the complaint filed.
In order to settle this point of law, we must hear in mind the action instituted by plaintiffs, and not another action or remedy of which they could or should have availed themselves to obtain the end they pursue in the prayer of said complaint, because the impropriety of the remedy employed affects the cause of the plaintiffs, but not the jurisdiction of the court.
Taking the above-mentioned doctrine as a guide, it is proper to ask:
Has the District Court of Aguadilla jurisdiction to take cognizance of the causes in question, or is it incumbent upon the Municipal Court of Añasco, as maintained by plaintiffs, Antonio Diez and José B. Pérez?
Has the said court of Aguadilla jurisdiction to try the case, which involves an action seeking to annul proceedings instituted in a municipal court situated, as has been alleged by defendant Arrarás, within the judicial district of the District Court of Mayagüez, or does such jurisdiction lie with the latter court?
Under section 4 of an act reorganizing the judiciary of Porto Rico, approved March 10, 1904, municipal judges shall have jurisdiction in all civil matters within their districts to the amount of $500, including interest.
The action instituted does not involve a claim- for an amount less than $500, since the annulment of the sale at public auction to José B. Pérez, of the deed executed in his favor and of the record thereof in the registry, is requested. The sale was made for $550 and, therefore, the subsequent acts of executing the deed and recording the same in the registry partake of similar conditions.
*518The complaint further prays the court to annul the judgment rendered by the Municipal Court of Añasco adjudging Carmen García, in view of the counterclaim filed by José Arra-rás in an action of which said court had cognizance, to pay Arrarás the sum of $751.20 for interest due on a mortgage credit plus $500 for attorney’s fees. The first of these items alone is in excess of $500, the maximum amount of which municipal courts can take cognizance. The annulment of the proceedings for the execution of the aforesaid judgment is also requested, and this petition follows the fate of the judgment the amount of which is in excess of $500.
Although the annulment of the foreclosure proceedings instituted in the Municipal Court of Añasco by José Arrarás against Carmen Garcia to recover a credit of less than $500 is requested in the complaint, it is therein set forth as a fact that in said proceedings the sale, the deed, and the record in the registry, the annulment of all of which is sought, were made, although the interest involved in these transactions was in excess of $500, and as the nullity of the proceedings is alleged as grounds for the other annulments, jurisdiction of the former lies with the same' district court, which may try the latter, and not with the Municipal Court of Añasco, the unity of the case being thus preserved.
The Municipal Court of Añasco, therefore, has no jurisdiction to take cognizance of the complaint filed. We have now to determine whether or not such jurisdiction exclusively lies with the District Court of Mayagüez and not with that of Aguadilla.
We are of the opinion that the District Court of Agua-dilla had and has jurisdiction of the action for the annulment of the proceedings and other processes, since the same is matter falling within the jurisdiction of district courts, which are courts of general jurisdiction.
Jurisdiction is the power with which the courts are vested to administer justice, and competency is the power they have to take cognizance of certain actions either on account of *519the nature of the things or on account of the persons, as laid down by this court in the decision of the case of Gavino Garcés Nazario v. Damián Franceschi, decided July 12, 1900. (Sentencias del Tribunal Supremo de Puerto Pico, Yol. I, p. 282.)
“Jurisdiction,” as the learned commentator, Manresa, says, “always emanates directly and immediately from the law; it is a power which nobody upon whom the law has not conferred it can exercise; jurisdiction is had by, and the power to administer justice is vested in, those persons only upon whom the law has conferred such power. But the competency of a judge to take cognizance of a cause, although it may also be derived from the law, sometimes originates directly, immediately, and exclusively therefrom, and at other times it originates from the will of the parties. The former case is the general rule and the latter the exception.”
Therefore, while jurisdiction cannot he conferred by consent of the parties, the contrary holds with respect to competency. If by virtue of law a court lacks jurisdiction to take cognizance of an action, the consent of the parties can never confer such jurisdiction.
On the other hand, if a court lacks competency to take cognizance of an action, it acquires such competency, if it has jurisdiction of said action, by agreement or submission of the parties, in accordance with sections 76 and 77 of the Code of Civil Procedure.
A demurrer taken under subdivision 1 of section 105 of the Code of Civil Procedure, that the court has no jurisdiction over the person of the. defendant or over the subject matter of the action, is proper when the court has no jurisdiction; but when the court has such jurisdiction hut lacks; competency, as when the complaint has not been filed in the district court that according to law should take cognizance thereof, then the demurrer, for want of jurisdiction, should not he pleaded, but a motion made that the case be tried in *520the proper district, according to the provisions of section 82 of said code.
When a court has jurisdiction it cannot refuse to take cognizance of an action even though such court is incompetent, because such competency may be conferred upon it by the express or implied submission of the parties themselves.
Applying the preceding doctrine to the case at bar, we are of the opinion that the District Court of Aguadilla has jurisdiction to try the case as brought before it, and that if, for any reason whatever, the defendants believe that the District Court of Mayagüez was competent to take cognizance thereof they should have filed a motion for the transfer of the same, in pursuance of the provisions of the Code of Civil Procedure. (See Fajardo et al. v. Tió, 17 P. R., 230, and Ponce and Guayama R. R. Co. v. Antonetti, 17 P. R., 310, decided on February 24 and March 27, respectively, of the current year.)
The transfer of the case not having been requested in •due form, the same should be proceeded with in the district court where it was originally filed.
For the foregoing reasons the demurrer as to the lack of jurisdiction not being well founded, the judgment appealed from should be reversed, and the District Judge of Aguadilla should be permitted to pass upon the other demurrer which he Abstained from deciding.
Reversed.
Justices MacLeary, Wolf, and del Toro concurred. Mr. Justice Aldrey did not take part in the decision of this case.