The standard theory of anti-poverty targeting assumes individual incomes cannot be observed, but statistical properties of income distribution in broadly defined groups are known. Targeting rules are then derived for the forms of transfers conditioned on group membership of individuals. In this literature the motivating notion of a “group” is purely statistical, even when it is groups such as localities and ethnicities. We model instead a group as a “community”, meaning thereby a collection of individuals who have access to a community-specific public good, from which non-members are excluded. Such differential access constitutes a source of inequality among poor individuals belonging to different communities. We show that this formulation of what constitutes a group changes many of the basic results of the targeting literature. Optimal targeting for poverty alleviation leads to seemingly paradoxical rules, such as targeting transfers to the community that is richer. Total wealth of non-poor members of a community and its distribution both become relevant for specifying optimal targeting rules.