In legal terms, a mortgage is a lien, meaning a property right given to a lender (the bank or insurance company) by a borrower (the homeowner) in exchange for a loan, until the debt is repaid.
This loan can then be used, together with personal assets, to finance the property in question.
Getting a home loan places a number of contractually defined obligations on you as the homeowner, not least of which is the payment of mortgage interest rates. The property you mortgage to the bank serves as collateral in the event that you do not fulfill your agreed-upon obligations.
If you don’t meet your obligatory payments, the mortgage holder has the right to sell the property and apply the money gained towards covering your debt. So the property itself serves as a security, making it possible for you to get the loan.
Like banks, insurance companies can also act as lenders. Generally mortgage loans never need to be repaid, as long as no amortization schedule has been agreed to (in the case of your first mortgage), because the loan tenure is unlimited.
More information:
Mortgages in Switzerland compared
First mortgage - simply explained
Amortization - simply explained