A restricted edge-cut S of a connected graph G is an edge-cut such that G−S has no isolated vertex. The restricted edge-connectivity λ′(G) is the minimum cardinality over all restricted edge-cuts. A graph is said to be λ′-optimal if λ′(G)=ξ(G), where ξ(G) denotes the minimum edge-degree of G defined as ξ(G)=min{d(u)+d(v)−2:uv∈E(G)}. The P-diameter of G measures how far apart a pair of subgraphs satisfying a given property P can be, and hence it generalizes the standard concept of diameter. In this paper we prove two kind of results, according to which property P is chosen. First, let D1 (resp. D2) be the P-diameter where P is the property that the corresponding subgraphs have minimum degree at least one (resp. two). We prove that a graph with odd girth g is λ′-optimal if D1⩽g−2 and D2⩽g−5. For even girth we obtain a similar result. Second, let F⊂V(G) with |F|=δ−1, δ⩾2, being the minimum degree of G. Using the property Q of being vertices of G−F we prove that a graph with girth g∉{4,6,8} is λ′-optimal if this Q-diameter is at most 2⌈(g−3)/2⌉.