Territoriality is a natural characteristic in dogs, one which hails all the way from their wolf ancestors. In the wild, wolves would patrol their territories to collect vital information, such as the availability of food and water and the presence of intruding animals; intruding animals were a serious threat, given the fact that they could both compete for resources and harm young. Everyone knows that wolves, and dogs, mark their territory by urinating or defecating in certain areas. Your dog considers his home and the area surrounding his home as his territory; he will also consider the places you visit when taking him on a walk as his territory.
In some cases, breeders wanted to breed the wolf's territoriality out of the domestic dog, to make him friendlier and easier to get along with. In other cases, however, breeders wished to encourage the dog's innate sense of territoriality; indeed, dogs with a high sense of "this is my turf" made good watch dogs and guard dogs, a purpose for which many breeds were developed. Terriers were one of these breeds. Their watch dog capabilities were actually second in importance to their primary purpose; to rid farms and houses of vermin.
The Welsh Terrier was bred to hunt and kill rats, foxes and badgers, along with anything else that stepped foot on his master's farm that could threaten crops and/or the chickens. This was a very useful trait for farmers, as any damage to their crops or livestock could have dire consequences for their livelihood. His territorial behavior also proved useful in employing the Welsh Terrier as watchdog and guardian, especially of children. Like any other characteristic, though, an excessive display of territoriality can be very harmful, especially in more densely populated areas. Indeed, the Welsh Terrier territoriality may have come in handy on British farms in the 1700s or before, but it can be problematic for the dog owner who lives in a suburban or urban setting. Welshies that have exaggerated territorial behavior will bark excessively, urinate in the house, growl at and attack visitors.
The first step in making sure your dog does not have problems with territoriality is to purchase your Welshie from a reputable breeder who uses dogs with only the best personalities for his breeding program. After you bring your Welshie home, you MUST make sure you socialize him sufficiently; take him out to meet other people and dogs, try to get friends to come over as much as possible and try to get dogs to visit as well. This will accustom your Welshie to seeing people on "his territory" and he will not view others as threats. Besides socialization, obedience training is a must for territorial breeds like the Welsh Terrier. Teach your dog to obey commands, such as "sit" and "stay", to both reinforce your role as pack leader and to be able to control your dog should any territorial tendencies surface.