Section 36. The provisions of law relative to limitations of actions shall apply to a counterclaim by the defendant. The time of such limitation shall be computed as if an action had been commenced therefor at the time the plaintiff's action was commenced.
Notwithstanding the provisions of the first paragraph of this section, a counterclaim arising out of the same transaction or occurrence that is the subject matter of the plaintiff's claim, to the extent of the plaintiff's claim, may be asserted without regard to the provisions of law relative to limitations of actions.
This section shall apply to actions brought by the commonwealth or for its benefit.