Building Energy Self-Sufﬁciency of Municipalities on the Basis of National Legal Conditions in the Theoretical Perspective of the Polish Legal Experiences

: In today’s social, economic, and political reality, it cannot be overlooked that the energy self-sufﬁciency of municipalities not only optimizes the lives of the inhabitants of the municipality but also, in a broader perspective, the services provided by the municipality. The sustainable development of a municipality will therefore depend on its degree of self-reliance and self-sufﬁciency. Economic and technological considerations are not sufﬁcient for the municipality to achieve optimal energy independence without normative conditions. The current (2021/2022) trends in electricity prices and in the development of national and international policies and strategies for electricity generation from renewable energy sources also make the change in the energy market structure toward distributed generation. The main objective of this paper is a theoretical analysis of the legal solutions in force in Poland that allow building energy self-sufﬁciency in municipalities and their adequacy to the current economic, technological, and political conditions. The scientiﬁc discussion will focus here on research problems related to the impact of the national regulations on the gradual assumption of control by municipalities over the generation and distribution of electricity with regard to energy produced in RES installations and the independence of municipalities from the national energy management and supply system.


Introduction
In the global context, sustainable development of urban agglomerations is one of the goals of the international community. On 25 September 2015, the UN General Assembly adopted a resolution Transforming our World: The 2030 Agenda for Sustainable Development [1]. This document adopted 17 sustainable development goals, the 11th of which directly addresses the matter at hand. The goal intends to make cities and human settlements safe, stable, sustainable, and inclusive. This target is still being implemented [2]. In today's social, economic, and political reality, it cannot be overlooked that new technologies and energy self-sufficiency do not only optimize the lives of the inhabitants of the municipality, but also the functioning of the municipality themselves, which by default are supposed to be safer, more efficient, and, most of all, friendlier. This concept, which is part of the much broader Smart City initiative, is slowly but surely paving its way to this reality [3] (p. 191). When it comes to this study, we may rest on a statement that it is about developing a model of a municipality in which the satisfaction of collective needs is to contribute to maximum interactivity and efficiency of municipal infrastructure, but taking into account the social capital of the agglomeration and its real needs [4,5] (p. 338). Doing so, we may avoid the vision of cities of the future that disregard sustainable management of natural resources, public participation, and improving the quality of life of all residents. Therefore, it is easy to imagine a few segments of development of such an agglomeration that will be closely related to broadly understood environmental protection and the related technologies that allow for the rationalization of how we use natural resources (especially energy sources) [6] (p. 1134). However, there is no doubt that an improvement in the quality of life of all inhabitants (related, for example, to smog-free air, a reduction in energy poverty) will inevitably be related to the use of alternative energy sources and uninterrupted electricity generation. This is why, the achievement of the most important municipality goal that allows the urban agglomeration to develop sustainably in all aspects of its operation will depend on the degree of self-reliance and self-sufficiency of such cities, which will mainly allow optimal energy independence. Given the current-2021/2022-trends related to the price of electricity and to its availability and undisturbed supply, we must note that the development in obtaining it from renewable energy sources is not only needed but also necessary. However, the economic and technological considerations alone are not the sole reasons that are currently forcing the direction toward the choice of renewable energy sources and their development [7,8] (pp. 2772-2774). We are talking here about normative considerations, both at the national and international levels. The literature has no doubt about the impact of the role of law and policy on the perception of strategies related to access to energy and its production [9] (p. 487).
When it comes to international law, the European Union is the main factor that sets today's trends directed at green energy. It focuses on the greater reduction of CO 2 emissions by maximizing the acquisition and production of electricity from renewable sources by implementing specific directives and through the application of resolutions that form part of the more comprehensive "Clean Energy" package. It also focuses on sectoral strategies related to the European Green Deal [10] (p. 88). The main goal of the energy transformation is to lower greenhouse gas emissions by 40% compared to 1990, along with increasing the share of renewable energy supply to the 32% threshold in the EU energy mix and improvement of energy efficiency by 32.5%. The EU-level changes contribute to changes in national legislation. For example, Poland's Council of Ministers adopted on 2 February 2021 a document called "Energy Policy for Poland until 2040" (hereinafter: PEP2040) [11]. This act outlines the direction of energy transformation in Poland. The most important consequences of the adoption of this document for the Polish direction of energy policy include just transition, a zero-emission energy system, and good air. One of its goals is to develop and expand the energy generation infrastructure which is to be based on zero-emission sources in the 2040 perspective. This is why, one aspect of this policy will involve guaranteeing greater integrity of renewable energy sources in the energy mix by the development of storage technologies, which by default are to ensure greater reliability of supply and flexibility in electricity generation [11] (pp. [22][23]. However, despite these technological challenges, it was assumed that the share of RES in gross final energy consumption in 2030 will translate into a 32% share (at least) of RES in net electricity generation, which may amount to at least 40% in 2040. The forecast of the possible share of RES in final energy consumption is showed in Table 1. The planning of the transition of current agglomerations into sustainable municipalities cannot proceed without environmental solutions relevant to the obtaining of various forms of energy, especially energy from renewable sources. This results from current political and economic directions as well as corresponding legal measures in place. It must not be forgotten that the municipality, unlike other participants in legal transactions (natural persons, entrepreneurs, foundations, associations, etc.), does not have the same degree of freedom in shaping its position in the market, especially in terms of service provision. The municipality acting on the basis and within the limits of the law may establish relationships with other market participants. It is possible because regulations of the law acknowledge a municipality as an independent participant in legal relationships by granting it legal personality and equipping it with a property that it is to manage. However, the way legal personality is used, even to achieve the above-mentioned goals, must be in accordance with Polish legal solutions included in the Constitution and other legal acts (the Civil Code, local government acts, etc.). Infringement of the powers granted even to achieve the above objectives will give rise to the invalidity of legal relations and liability for breach of financial discipline. The granting of legal personality to the municipality results in acquiring the status of a hybrid entity in legal transactions. First of all, it combines the capacity to create civil law relations on its own behalf with the competence to take administrative decisions in individual cases (in the exercise of public authority) and with acts of local law. The municipality, while retaining this multi-faceted identity, cannot, depending on the nature of its activities, accumulate the rights vested in it. As a result, when acting in private law transactions, the municipality is subject to rules that are binding upon all participants, and thus cannot shape the rights and obligations of its contracting party by its own authority, which is permissible in the exercise of public authority. Nevertheless, as a subject of law, the municipality remains a special entity. Unlike other legal entities equal to it, it cannot enjoy the same degree of autonomy in deciding its intentions and the manner of their implementation. Therefore, the municipality may only undertake activities on the basis of and within the limits of particular legal regulations, which is directly relevant to the possibility of achieving energy self-sufficiency of municipalities.
Given the above, we must find answers to the following research questions: (1) Can a basic local government unit effectively support electricity generation from renewable sources at the local level in the current Polish legal reality; and (2) In light of the current Polish legal regulations, are municipalities capable of building their energy self-reliance and of transforming into sustainable urban agglomerations?
Gradual answers to the above questions will allow verifying the basic hypothesis of the research process presented below, that if there is no appropriate legal regulation at the national level, despite favorable economic, technological, and political conditions, it will not be possible to initiate or strengthen the municipalities' aspirations for energy self-reliance.

Materials and Methods
This study is theoretical in nature, hence the statistical elaborations expressed in the form of tables and figures are merely illustrative and are not based on the results of empirical research. Their main purpose is to outline the non-legal factors (economic and political context), which will allow for better visualization and assessment of the adequacy of current Polish legal regulations for building energy self-sufficiency in municipalities. The study used research methods appropriate for legal sciences, classified as social sciences. Among the three main research methods (dogmatic, historical, and comparative) used in the Polish legal doctrine, the dogmatic method was chosen [12]. This research method allows for a meticulous study of the law in force, which focuses on the analysis and interpretation of legal regulations. Moreover, the dogmatic method allows, in the process of studying the law in force, to take into account the views expressed in the literature and judicial decisions, as well as to determine the goals that these norms are supposed to achieve. Hence, the use of the statistical studies mentioned at the beginning is not only necessary but also justified. The dogmatic method also allows for the assessment of the current legal state (de lege lata conclusions) and for the proposal of changes to this regulation in the future (de lege ferenda conclusions). For the purposes of the process of interpreting legal regulations and creating legal norms based on them, the derivative concept of law interpretation created by Prof. Maciej Zieliński has been used [13]. It is expressed in the Latin maxim "omnia sunt interpretanda". This concept starts with linguistic interpretation, whose task is to determine the meaning of expressions used in a legal text (legal regulations). In this concept, it is particularly important to distinguish between a rule of law (understood as an independent editorial unit of a legal text taking the form of a sentence in the grammatical sense) and a legal norm (as a result of the process of interpretation of the legal text, which determines the addressee to behave in a certain way in certain circumstances).

Current Economic and Political Reality in the Polish Electricity Market as a Non-Normative Determinants in the Progression of Municipality to Energy Self-Sufficient with RES
Given the current upward trend of prices on the Polish electricity market and property rights associated with certificates of origins of energy from renewable sources such as wind, water, geothermal processes, sun, or biomass combustion (PMOZE and PMOZE_A instruments), the direction towards environmentally friendly energy sources is not only a pressing issue to mitigate the growing greenhouse gas emissions and to impede the dynamically proceeding climate change. The growing pressure to leave behind fossil fuels in favor of their alternatives will slowly become economic rationality, especially when it comes to the operating costs of such an activity. Looking at the situation at the Polish Electricity Commodity Exchange (TGE), we may point out that both on the monthly scale (in 2021) and on the yearly scale (2016-November 2021, on the basis of data available while the paper was being written), there is a successive increase in the value of property rights coming from certificates of origin of energy from renewable sources, as presented in the Table 2. This means that the price grew by 69.31% in eleven months. We must only add that trading in certificates of origin is one of the forms of support for green energy producers.
In turn, the average annual price of electricity in the competitive market in a 13-consecutiveannual perspective (2008-2020) [14] grew by 62.56% in the investigated period, as shown in Figure 1. This means that the price grew by 69.31% in eleven months. We must only add that trading in certificates of origin is one of the forms of support for green energy producers.
In turn, the average annual price of electricity in the competitive market in a 13-consecutive-annual perspective (2008-2020) [14] grew by 62.56% in the investigated period, as shown in Figure 1. However, if we analyze quarterly data for the price of electricity, it turns out that 2019 marked a steady increase in the value of 1 MWh, and this trend held in the first and second quarters of 2021 (results for the third and fourth quarters of 2021 had not been released yet when this text was being written) compared to previous years, as shown in Figure 2. Annual increase (%) of the selling price of electricity However, if we analyze quarterly data for the price of electricity, it turns out that 2019 marked a steady increase in the value of 1 MWh, and this trend held in the first and second quarters of 2021 (results for the third and fourth quarters of 2021 had not been released yet when this text was being written) compared to previous years, as shown in Figure 2. PEP2040 in its Appendix 2 includes conclusions from forecast analyses for the energy sector shows the forecast for prices for end consumers until 2040 [11]. It is clearly demonstrated in its in Section 1.11.4. "Electricity price forecast" that the current rising trend of prices per KWh will hold till 2040. The main source of this state of affairs is sought in "the  PEP2040 in its Appendix 2 includes conclusions from forecast analyses for the energy sector shows the forecast for prices for end consumers until 2040 [11]. It is clearly demonstrated in its in Section 1.11.4. "Electricity price forecast" that the current rising trend of prices per KWh will hold till 2040. The main source of this state of affairs is sought in "the rising costs over time of purchasing CO 2 emission allowances and the costs of developing emission-free technologies". These reasons also include the COVID-19 pandemic's adverse effect on the economy. There is no doubt that the pandemic resulted in an unprecedented contraction in economic activity in 2020. Nonetheless, uncertainty and risks surrounding the outlook remain high, in particular pertaining to uncertainty about the future trajectory of the pandemic, inflation, energy prices, shortages in the labor market, and bottlenecks in international supply chains [15].
However, irrespective of the economic consequences of the current epidemiological situation, it must be concluded that the nearest time perspective-2050 for the EU [16] and 2040 for Poland-stipulates an array of changes in the energy policy. It is not only about technological methods for improved electricity production. Equally important are changes associated mainly with normative determinants that force an expansion of the production and network infrastructure and a modification of the model of energy markets that direct these markets towards zero-emission energy production. All of this must also take into account distributed energy generation, which uses the RES potential effectively on a local level [17] (p. 391); [18] (p. 2095). There are two contexts in this situation. The economic context relates to the permanent upward trend in electricity prices and the political context involves forcing increased production of a certain volume of energy from RES along with the growing demand for this energy. This means that each urban agglomeration should ensure complete energy self-sufficiency for themselves as one of the stages of its transformation, or at least majority self-sufficiency (at least in maintaining the continuous activity of ensuring the implementation of crucial tasks for the local community).
Given the political trend at the international and national levels, as well as current economic conditions, the direction toward renewable energy sources is obvious. However, the implementation of the above-mentioned long-term options for creating energy self-reliance at the national and supranational levels depends solely on the relevant legal regulations. Already now, it should be clearly stated that without appropriate institutional instruments backed by generally applicable law, it will not be possible to initiate or strengthen the energy transformation process, especially in the field of distributed energy generation. Even with legal regulations that support municipalities' aspirations for energy self-reliance, it is necessary for them to take initiative, including projects aimed at the local community. It is also one of the ways to reduce the cost of energy [19] (p. 666). Without appropriate legal foundations, municipalities will not be able to achieve politically outlined and economically justified goals in the energy sector, which aim first and foremost at lowering these costs.

Discussion about Normative Determinants in the Progression of Municipality to Energy Self-Sufficient
A municipality, as an initiator of a bottom-up change in the energy system in how electricity is produced, distributed, and consumed, does not enjoy unrestricted freedom in this regard. It needs to be highlighted that it is a special entity of legal relations. This organizational unit cumulates dominium as an entity that manages the due ownership and other property rights and imperium as an entity exercising public authority on the basis and within the limits of the law. For this reason, it is necessary to answer the questions asked in the introduction.
It is possible to answer these questions through reference to four legal acts (laws) that define the tasks and competencies of a municipality as a local government unit, that is: (1) Municipality Self-Government Law of 8  It can already be noted that the national legal framework referred to above deviates from international normative regulations, which see municipalities and local communities as a driving force for the energy transition. We may, for instance, note the EU initiative the Covenant of Mayors, which commits to developing sustainable energy. On the other hand, from a wide range of EU legal acts, we may quote Directive (EU) 2018/2001 of the European Parliament and of the Council of 11 December 2018 on the promotion of the use of energy from renewable sources (OJ L 328,21 December 2018, pp. 82-209, as amended) which directly refers to the potential of local communities and authorities which may create an energy community that acts for renewable energy. One must not overlook non-normative acts-program documents, such as the Opinion of the European Committee of the Regions on 'Models of local energy ownership and the role of local energy communities in energy transition in Europe' (OJ C, 86, 7 March 2019, p. 36). Unfortunately, their character as sources of Member States' legal obligations is relative. It depends on MS's discretion in implementing them in national orders and on the authority of EU bodies that issue them. The importance and capacity of these new structures to achieve goals vested in them must be normatively situated so that their position is effectively supported by other participants in energy trading [20]. This is why it is so important to determine whether the Polish legal status allows municipalities to manage their energy policy independently, if not with respect to the local community, then at least for the needs of their own operation, which are to go far beyond the mere opportunity to choose an energy supplier.
The fundamental problem to be solved in the case of Polish legal measures is to determine the scope of competence of the municipality to generate or support energy from RES: (1) May the municipality undertake this activity only for the benefit of the self-government community (e.g., to ensure an economically rational supply of technological solutions that facilitate operation in its area)? (2) May the municipality undertake this activity also within the scope which is not aimed at continuous satisfaction of the needs of this community?
The basic problem that must be settled-in the Polish legal environment-is to determine the scope of municipalities' powers to generate and support energy from RES solely for the benefit of the self-governing community (e.g., to ensure economically rational supply of technological solutions that facilitate operation in its territory) or whether it may also act in the scope not directed toward undisturbed satisfaction of the needs of this community. Special focus must be given to the fact that the municipality acts on the basis and within the limits of the law. It is because it is created on the basis of the law, with the purpose to exercise public tasks defined by the law (mainly for local communities). In this sense, a municipality may exercise tasks within its statutory powers (that determine the basis, form, and premises of activity) or under its material competence (e.g., non-authority-related activity such as the provision of services or undertaking public tasks). The said MSGL is a fundamental act here, whereas Articles 6 and 7 play key roles in the matter at hand. It needs to be emphasized that pursuant to Article 6(1) MSGL, the scope of the municipality's operation includes all public matters of local significance, not reserved for other entities by statutes. In turn, pursuant to Article 7(1)(3) MSGL, municipalities' own tasks include the satisfaction of the collective needs of a community, especially in terms of supplying electricity, heat, and gas. This public goal was specified in Article 18 EL, pursuant to which a municipality must plan and organize the supply of heat, electricity, and gas fuels in the territory of the municipality and is responsible for the rationalization of energy consumption and for the promotion of solutions that reduce energy consumption within its territory. As may be already seen, the current regulation that sets the scope of material competence of the municipality's activity and that assigns it suitable powers brings municipalities down to a marginal role in obtaining electricity from RES. Of course, we may use interpretation principles to try to interpret the legal possibility to effectively undertake activity in the scope analyzed out of the expressions "supply electricity" or "organize electricity supply". Nevertheless, these promising conclusions will not fully correspond with current principles of municipalities' conducting an activity (both economic and non-economic), or, even more, with the principles of supporting electricity generation in installations that use renewable energy sources, which by default are intended for business operators and households (e.g., green certificates (Articles 44 and 45 RESL) or the bidding system (Article 71 RESL et seq.) are instruments intended for businesses).
In light of these provisions, the activity of a municipality that involves the production of electricity from RES will not cause controversy if it intends to satisfy collective needs, on an ongoing and undisturbed basis; thus, it takes the form of public service [21] (p. 978), [22] (p. 299). In this aspect-taking into account RESL provisions-such an activity does not fit within the system of support for generating electricity from RES [23] (pp. 97-98). As much as the production of electricity from RES is accommodated under the municipality's activity's material competence, pursuant to energy law, supplying local communities with electricity (regardless of its source) is the responsibility of energy companies. Therefore, a municipality cannot provide such services, and definitely, it does not organize them directly by creating adequate technical, organizational, or financial conditions [24] (p. 176). In this light too, a municipality cannot be recognized-as a rule-as a producer pursuant to Article 2(39) RESL, which boils down to the concept of an energy company, though certain opportunities may be sought in distributed energy generation and in the concept of the prosumer. Pursuant to Article 2(27a) RESL, a prosumer means an end customer who generates electricity solely from renewable energy sources for their own consumption, in a micro-installation, provided that, for a non-household renewables prosumer, these activities do not constitute their primary business activity. However, the use of a micro-installation may not be sufficient due to restrictions on the power of the installation (up to 50 kW) that is connected to an electricity grid with a rated voltage lower than 110 kV. Therefore, if the activity must go beyond a public service, then the operator must start conducting the activity according to provisions of municipal management.
The said law specifies the principles and forms of municipal management of local government units, which involve the performance of this unit's own tasks in order to satisfy the collective needs of a self-governing community. It will mean, in particular, public service tasks, intended to satisfy the residents' collective needs on an ongoing and undisturbed basis, by the provision of universally available services. Local government units may carry out municipal management through specified forms, such as local-government budgetary establishments or commercial law companies. It must be expressly said that apart from the public services sphere, a municipality may only establish commercial law companies and enter them, provided that the following conditions are jointly met: (1) there are needs of the self-governing community that are not satisfied on the local market; (2) the unemployment in the municipality has great adverse effects on the level of life of the self-governing community and the application of other activities stipulated in legal measures in force has not brought about economic stimulation, in particular-major stimulation of the local market or lasting reduction of the unemployment. Therefore, we must agree with the views that municipal management is not based solely on public service tasks, which are only one of its manifestations [25][26][27]. Because a "self-governing community need" is a key issue for municipal management, we must recognize that the scope of municipal management, together with the development of civilization, changes in time and constantly evolves [25,27]. This is why compliance with efforts that intend to transform municipalities into technologically-developed agglomerations supported with RES installations with rules of sound municipal management should not raise any doubt. Besides, given the EU and Polish program documents referred to above, this is the natural direction of the development of local communities for the coming decades.
However, the recognition of whether the legal character of the activity aiming to generate electricity is to be that of a public service or not directly affects the choice of a relevant legal form for this activity. Ultimately, we cannot rule out a scenario that in the Polish legal status in force the activity with the use of RES will not be carried out by a municipality, but by a legal entity established by it (e.g., in the form of a commercial company), which in the legal sense has a legal personality separate from the municipality. In such a situation, the municipality, through exercising such a task, will inevitably have only an indirect influence over it [26,27]. Therefore, depending on the nature of this activity, on the one hand, it will be carried out directly by the municipality with the support of a budgetary establishment that is part of the municipality's organizational structure, which allows for the independent management of this activity. However, it is a variant dedicated solely to public services if the municipality's bodies do not opt to establish another legal entity for this purpose. On the other hand, it is possible to establish a new legal entity to achieve these goals, which in practice involves delegation of this task to an independent establishment that has links with the municipality in terms of capital [23] (p. 98). Here, the main actor will be the legal person created by the municipality, not the municipality itself. It is worth mentioning on the side that there is a third option under Article 3 MML. This provision is a basis for a local government unit to delegate municipal management tasks to natural persons, legal persons, and organizational units without legal personality by way of an agreement. This may also apply to the issue of RES-related activity discussed here (e.g., under public-private partnership). However, despite a comprehensive array of choice of forms for consumption of energy from RES, it is worth quoting here results of Szyrski's 2015 research on municipal renewables infrastructure [28] (pp. [5][6][7][8][9][10][11][12][13][14]. The author gathered data from 2267 municipalities (approx. 91% of total municipalities). As it turned out, commercial law companies were the basic legal form associated with renewable energy generation. Moreover, Szyrski concluded on the basis of the data analyzed that "only 2% of the municipalities investigated owned or co-owned power plants that used energy from renewable sources under separate legal forms" [28] (p. 14). In turn, "when it comes to installations other than power plants, 10% of municipalities investigated had infrastructure in place associated with the use of energy from renewable sources" [28] (p. 14). Therefore, it may be assumed that given the status of the then regulations and support principles for the production of renewable energy (such as an activity that may be recognized as going beyond public services, acquiring appropriate licenses, permits, or entries in relevant registers, public-aid related problems), the running of such an activity by a municipal legal person was more transparent than when it was done by the municipality itself.
Therefore, it should be concluded that Polish law currently does not provide sufficient legal forms for a municipality to independently carry out activities in RES generation to the extent corresponding to the political and economic conditions outlined in points 1 and 2. Contrary to the Polish law, the EU law includes the following legal acts, which regulate new forms of cooperation in which a municipality can participate: These include in particular: (1) Citizen energy community which can be described as a legal entity based on free and open participation and controlled by its members (shareholders), who may also be municipalities. One of the activities of such an entity is the production of energy, including from renewable sources, and its distribution. It may also provide other energy services to its members (shareholders), such as energy efficiency or energy storage services. Financial profit is not the main objective of this entity, which focuses primarily on benefits for the social community; (2) Renewable energy community means a legal entity that, in accordance with applicable national law, is organized on the basis of free and voluntary participation, is selfgoverning, and is controlled effectively by its members (shareholders). However, these communities may only engage in RES-related activities. Their members (shareholders) can be municipalities, individuals, or SMEs. Financial profit is not the main objective of this entity, which focuses primarily on benefits for the social community.
Therefore, it is clear that without appropriate national regulations, it is not possible to use the initiatives identified above to promote RES investments. This can only be achieved by combining legal acts at the EU, national, and local levels.
Although the Polish legal system does not regulate the possibility for municipalities to act independently in the field of low-carbon energy production, an opportunity to directly model the use of alternative energy sources may be sought in distributed energy generation. The 2016 RESL amendment added two significant measures: energy clusters and energy cooperatives, which are part of the citizen energy community, and the renewable energy community described above. The participation of the municipality itself is reinforced by the content of Article 2 MML, whose catalog of organizational forms for the municipality to conduct public services-related municipal management allows this catalog to be recognized as not closed and exhaustive.
Judicial decisions of common courts of law and of courts that review the activity of public administration uniformly agree that local government units may use and create any legally admissible organizational forms [29,30]. This is why the energy cluster construct may meet the expectations of intensifying efforts for the production of energy from renewable sources [31] (pp. 155-156). An energy cluster is an agreement under civil law that may be formed by natural persons, legal persons, higher education, and science institutions or local government units that pertains to the generation and balancing of the demand for, distribution of, and trading in energy from renewable energy sources or other sources or fuels, as part of a distribution network with rated voltage lower than 110 kV, in the cluster operation area that does not go beyond the boundaries of one county or five municipalities. It is also important that an energy cluster is represented by a coordinator. He may be appointed for this purpose by a cooperative, an association, or a foundation or he may be any member of the energy cluster named in the civil law agreement. After the 2018 repeal of Article 38a (1) and (2) RESL that required that the cluster coordinator have a separate license or be entered in the register of regulated activity, this responsibility rests only with cluster members who are producers and should have a suitable license or entry [32]. For this reason, a municipality may also be a coordinator. A cluster is intended to be a form of collaboration of energy market participants in a local dimension. Thus, it may enable energy self-reliance at a local level [33]. It will also formalize collaboration within distributed sources of energy.
An energy cooperative also has similar functions. It is an entity whose objects involve the production of electricity or biogas, or heat, in renewable energy source installations and balancing the demand for electricity or biogas, or heat, exclusively for its own and its members' use, connected to a territorially defined electricity distribution network with a rated voltage lower than 110 kV, or a gas distribution network, or a district heating network.
However, when analyzing the legal regulation of energy clusters and energy cooperatives, one can point to several institutional and legal barriers that prevent the dynamic development of distributed energy despite favorable political and economic circumstances. The deficiencies of this regulation in comparison to the content of the directives referred to before are based on the following barriers: 1.
The definition of citizen energy community quoted before has a wider scope when it comes to the distribution of energy generated than measures established in the Polish legal order in the form of energy cooperatives and energy clusters; 2.
In the case of an energy cluster, there is no clear definition of its legal form; 3.
There are no clear rules for the settlement of accounts between energy enterprises and energy cooperatives. There is still no regulation on the registration, balancing, and provision of measurement data and settlements of energy cooperatives, despite the relevant authorization under Article 38c(14) RESL, 4.
Doubts about energy cooperatives having to obtain a license to trade in electricity.

5.
The obligation for an energy generator belonging to a cluster to obtain all legally required permits, licenses, and registrations.
Given the complexity of the problem associated with the direct generation and obtaining of electricity from RES installations to an extent that allows building energy self-reliance by the municipality, as well as the barriers to achieving this goal, we may also point to an easier way to build energy-sufficient municipality, though on a much smaller scale. Municipalities' increased drive towards RES installations only associated with the status of the producer of "green energy" or based on close cooperation with such a producer (e.g., municipal commercial companies, energy clusters, or energy cooperatives) may be a challenge that overwhelms municipalities' capabilities in the current legal status [34] (pp. 134-135). Thus, partial energy self-reliance, on a smaller scale, not when it comes to a specific local community but specific installations or technological solutions used in this community, will be possible through increasing energy efficiency.
Municipalities, as public sector units, bear the responsibility to apply measures for the improvement of energy efficiency, which involves, in particular, the implementation and financing of projects that serve the improvement of energy efficiency (Articles 6 and 7 of the Energy Efficiency Law of 20 May 2016 (consolidated text, Journal of Laws of 2021 item 468, as amended)). Such projects are to have an effect mainly on energy savings as a result of the implementation of specific actions, such as photovoltaic installations on roofs of municipality-owned buildings which are to ensure their continuous usability irrespective of the situation of the energy market or a potential black-out (for example in off-grid installations).
However, maximizing the energy efficiency of the broader municipal infrastructure is not the only way to influence the energy transition toward RES. A strive to intensify the use of renewable energy sources may also be sought in municipalities' planning responsibility. In planning supply of e.g., electricity at the local level, municipalities are responsible for drafting planning documents called goals for the heat, electricity, and gas fuels supply plan. Pursuant to Article 19(3) EL, their content takes into account the possibility to use existing surpluses and local resources of fuels and energy, including electricity and heat generated from renewable energy sources, electricity and useful heat from cogeneration, and management of waste heat from industrial installations. The draft goals are drawn up for the municipality's territory for at least 15 years and are updated at least every 3 years. However, the status of this planning in Poland does not look optimistic either, which is shown in Table 3. It should be noted that integrated analytical models are presented in the literature to support strategy development and decision-making in the selection of the most optimal green energy source [35].

Conclusions
The economic forecasts presented in the paper, associated with constant price increases for 1 MWh of electricity, caused mainly by the economic crisis triggered by the COVID-19 epidemic, force the search for alternative sources of relatively inexpensive electricity even more. Such trends fit within ongoing actions for the implementation of pro-ecological longterm solutions, in which the EU leads the way, followed by its Member States, including Poland. International and national intentions that aim for a specific percentage of electricity to come from renewable sources in the global energy mix (as much as 40% in the EU) inherently involve a sustainable evolution of urban agglomerations into places ultimately friendly, not only for the residents but also for the environment. Building a municipality on such foundations calls for technological solutions and requires that the energy security of such a local community be ensured through it gradually becoming independent from systemic electricity supplies and from energy companies by means of distribution and transmission networks. However, thanks to new technologies, energy production that so far has been the sole domain of energy companies is becoming possible in the conditions of local communities. Nevertheless, technological, economic, and political aspects cannot independently affect the structure of the electricity market without corresponding legal changes. It is because only legal regulations that allow municipalities to take suitable measures within the limits and on the basis of the law will allow a dynamic development of local energy markets and their security. In particular, they will contribute to the progress of the budding concept of dispersed energy generation. Without an adequate synergy between these factors, a relevant constant development is not possible; in particular, one cannot identify all the risks and costs of the expected results. On the one hand, economic and political forecasts allow us to determine broadly the benefits of creating foundations of technologically modern urban agglomerations on the basis of renewable electricity sources, such as (1) municipalities' modern and ecological image; (2) reducing environmental pollution, especially air pollution, by zero-emission electricity generation; (3) reducing electricity costs; (4) reinforcing local energy security. On the other hand, however, without corresponding normative measures, municipalities will not be able to achieve them.
At the moment, we need to come to a conclusion that the role of the municipality in the normative context associated with supplying energy from RES to the self-governing community that forms it is highly insufficient, or even marginal.
In the light of the current Polish regulations, and, in particular, the acts that determine its system and scope of activity, a municipality cannot independently commence an activity oriented toward the generation of energy from renewable sources. One of the reasons for this state of affairs is the fact that such an activity cannot be considered a public purpose and, consequently, there is no competence to undertake it. Therefore, municipal management related to low-carbon energy may only be carried out by the municipality indirectly, i.e., through commercial companies or other entities (e.g., energy cooperatives). Among the tasks that the municipality may undertake independently in the field of distributed energy is the effort to increase the energy efficiency of its infrastructure.
Therefore, the municipality may largely focus on planning and strategic tasks, rather than those for the real creation of "green energy" as the national law does not contain adequate competence standards. Current measures under RESL, even for the prosumer market, are not addressed to local governments, focusing only on preferential treatment of an energy producer in a household. Of course, an energy cluster is in a sense a remedy for such a situation, but by default, it is oriented at the work of the municipality-even as a coordinator-in agreement with other actors, rather than at independent activity for the production and distribution of electricity from RES installations. Orienting the municipality at pro-ecological solutions and those coming from renewable energy sources among its public goals does not raise major doubts. However, the lack of suitable competence norms that would allow effective implementation of such task-based norms is becoming a problem that makes it impossible to free municipalities' potential. Such flaws are noticeable already at taking the first strategic decision, that is the choice of the legal form for conducting municipal management-whether it is to be conducted by the municipality directly or indirectly through a municipal legal person established by it, which will fit better within the current system of supporting energy from renewable sources. Legislative uncertainty in elementary questions, such as the admissibility of the municipality running an economic activity and the related consequences (especially in the context of financing and public aid at the national and EU level) or this activity being a public service and consequences of conducting an activity that goes beyond this scope, cause municipalities' low activity in reinforcing predicted results of the share of RES energy in the total energy mix. Under such legal conditions, the process of transformation of municipalities will not be based on progressive independence from the national electricity distribution system, but on the use of concrete technological solutions to ensure energy efficiency, such as photovoltaic installations. They still remain wholly reliant on the national energy market. As a result, the questions asked in the first part of this paper must get conditionally negative answers. As may be seen, basic legal acts in the area of municipality activities such as MSGL and MML do not directly refer to the ongoing changes towards energy from renewable sources. The lack of clear regulations related to defining the municipality's own tasks and of means of achieving them is in line with the content of the EL and RESL, which, while directly shaping the energy market, do not take into account basic local government units in the transformation of the energy sector. Currently, the municipality may only indirectly participate in the use of energy from RES as a participant of other structures (e.g., commercial law companies). It may take measures to make energy demand and energy supply more efficient, in particular by means of cost-effective end-use energy savings. The lack of identical legislative support in other aspects of green energy use is particularly noticeable in the development of energy plans. As a result, effective support for electricity generation from renewable energy sources at the local level is currently only possible in terms of rationalizing the energy efficiency of specific facilities and installations used in the municipality. Undertaking such activity by municipalities will be treated as implementing and financing a project aimed at improving energy efficiency.
Further legal changes that support distributed energy generation, though focused also on local government units, are necessary. However, given the long-term RES-oriented policy, we may assume that relevant amendments will be introduced and energy clusters are heralds of such changes focused on local government units. As a consequence, sustainable development of the concept of distributed energy generation is a product of coherentlyproceeding and mutually-complementing economic, technological, and political processes for which suitable legal regulations are a driving force. For this reason, legal determinants at the national level are currently an inhibiting factor for municipalities' direct active participation in the generation and supply of energy from RES, especially to cover their own energy needs. Unfortunately, in the current legal circumstances in 2021, the absence of adequate support must be treated as a factor that slows down the process of municipalities' transition into energy self-sufficient and supporting RES entities, which is beginning to be equally natural and obvious as today's talk about resigning from fossil fuels in favor of renewable energy sources.