BEIJING — In Chinese schools, students learn that the United States became a great nation partly by stealing technology from Britain. In the halls of government, officials speak of the need to inspire innovation by protecting inventions. In boardrooms, executives strategize about using infringement laws to fell foreign rivals.

China is often portrayed as a land of fake gadgets and pirated software, where intellectual property like patents, trademarks and copyrights are routinely ignored. The reality is more complex.

China takes conflicting positions on intellectual property, ignoring it in some cases while upholding it in others. Underlying those contradictions is a long-held view of intellectual property not as a rigid legal principle but as a tool to meet the country’s goals.

Those goals are getting more ambitious. China is now gathering know-how in industries of the future like microchips and electric cars, often by pushing foreign companies attracted by the country’s vast market into sharing their technology. It is also toughening enforcement of patents and trademarks for a day when it can become a leader in those technologies — and use intellectual property protections to defend its position against rival economies.